August 16th, 2013, 06:08 PM
Spawn 2 python scripts at same time in windows
I have 2 python scripts and successfully executes when run in sequential, but i am looking to have 1 master script which will execute 2 scripts at the same time, gather results from 2 scripts into a master script.
Could some one please help me to achieve this?
August 17th, 2013, 03:11 PM
What you're describing is a multi-threaded application , in which you will be launching two scripts in their own threads and then retreiving the results asynchronously. I don't do a lot of this kind of programming, but the place you want to start reading is here:
Your "master" script is going to have to create two threads, start them, and then wait for each to complete.
August 17th, 2013, 10:00 PM
multi-processing is another way to go.
I'd write a shell script to launch the programs or submit them to the batch queue. In unix,
python p1.py &
python p2.py &
In DOS, (except that you'd need to look up the command) but effectively,
start /nowait python p1.py
start /nowait python p2.py
[/code] are essential for python code and Makefiles!