Launching Multiple Screen Commands through python -
i have multiple python files run. how launch files within 1 .py script? came shows screen action , doesn't begin other stuff unless exit out of it. here's code, not much:
import os print("launching bot, you.") print("loading shard 0") try: os.system("screen python3.5 run_0.py > /dev/null") except: print("shard 0 failed") print("loading shard 1") try: os.system("screen python3.5 run_1.py > /dev/null") except: print("shard 1 failed") print("done running shards...")
i doing research , said use subprocess when used it, didn't run command properly. (i don't have copy of code, lost it).
the problem want run python script , works fine have close screen start other 1 , want run command w/o showing output. can help?
you should use import subprocess
in python file. can start other instance of other programs :
subprocess.popen([sys.executable, "newprogram.py"])
you can mix multiprocessing
package launch 1 thread new program
p = multiprocessing.process(target= mp_worker , args=( )) p.start()
where mp_worker
launches other program.
Comments
Post a Comment