[英]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.