![](/img/trans.png)
[英]Run a program from python, and have it continue to run after the script is killed
[英]Run python in background from other python program and continue
如何在另一个 python 程序之间运行 python 程序
os.system(r'pythonw.exe D:\text.py')
我已经尝试过了,但是它在主程序之间暂停执行并且也尝试过
subprocess.run(r'pythonw.exe D:\text.py')
假设我有程序 text.py 每小时通知我一次我有主程序,即
code...
os.system(r'pythonw.exe D:\text.py')
code...
print("hello world")
我的命令应该在后台运行 text.py 并执行以下代码。
您可以使用名为“Soldier”的 Python 库。 这非常易于使用和实施。 https://pypi.org/project/soldier
import soldier
firefox_process = soldier.run('firefox', background=True)
firefox_process.pid
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.