Oct-30-2018, 04:03 PM
Oct-30-2018, 04:25 PM
Quote:or copy files?Is this your real goal?
If so, there's a better solution than running another program
Oct-30-2018, 04:45 PM
its just a or
I allso want to now this: "How can I start a python program out of a python program?"
I allso want to now this: "How can I start a python program out of a python program?"
Oct-30-2018, 05:07 PM
- You can import it. And then just run what you need from the imported module
import mymodule mymodule.myfunction()
- That being said, there are other ways, one (which is unsafe) is to use exec:
execfile('mymodule.py')
- You can spawn it using os (again not recommended):
import os os.system('python mymodule.py')
- And finally, save the best for last, use subprocess
import subprocess runproc = subprocess.run([python mymodule.py]) # if you need to capture output of mymodule use: runproc = subprocess.run([python mymodule.py] stdout=subprocess.PIPE, ) results = runproc() print(results)