Possible Duplicate:
How to call external command in Python
I'm writing a Python script on a windows machine. I need to launch another application "OtherApp.exe". What is the most suitable way to do so?
Till now I've been looking at os.system()
or os.execl()
and they don't quite look appropriate (I don't even know if the latter will work in windows at all).
You can run multiple instances of a python script from a shell however from within a python program without the use of multithreading/multiprocessing the GIL limitation will impact what you are trying to do.
The first line of 'import python_2' in the python_1 script, would call the second python_2 script. Whenever you want to run one Python script from another, you'll need to import the exact name of the Python script that you'd like to call.
The recommended way is to use the subprocess module. All other ways (like os.system()
or exec
) are brittle, unsecure and have subtle side effects that you should not need to care about. subprocess replaces all of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With