从另一个 python 脚本启动 python 脚本并在控制台中显示

start python script from another python script and show in console

我想问问是否可以在我的控制台中显示我从另一个脚本启动的 python 脚本的进度。我用谷歌搜索了很多,但找不到这样的命令。

是的,它可以称为线程或子进程,具体取决于您的需要。

在线程的情况下,stdout 将在您的主线程和其他线程之间共享,因此它很简单。

对于子进程,您必须使用 shell 功能,或者将子进程的输出设置为父进程的标准输出。
参见例如这个问题:Python subprocess output to stdout