Running multiple Python scripts from a single parent script
<p>I want to run multiple scripts at once (around 15), i'm assuming I can use the subprocess library to do this, I haven't had any experience with this though. </p>

<p>I'm currently playing around with this script: </p>

<pre><code>import os
from subprocess import *

#run child script 1
p = Popen([r'D:\python\loanrates\test\test.py', "test"], shell=True, stdin=PIPE, stdout=PIPE)
output = p.communicate()
print output

#run child script 2
p = Popen([r'D:\python\loanrates\test\test2.py', "test2"], shell=True, stdin=PIPE, stdout=PIPE)
output = p.communicate()
print output
</code></pre>

<p>Each python script it trys to run is simple (for testing purposes) </p>

<pre><code>import time 

for i in range(50):
    print i 
    time.timer(1)
</code></pre>

<p>Is this correct ? is this running each script ? It runs with no errors </p>

<pre><code>('', None)
('', None)
[Finished in 0.3s]
</code></pre>

<p>If so, what do I need to change in the child scripts so that the parent prints the outputs ? Or similarly what do i need to chnage in the parent so it prints the print functions in the child? </p>

<p>EDIT: the scripts i'm running are in different folders here i<a href="http://pastebin.com/xLk71nGm" rel="nofollow">s a pastebin for the actual scripts </a>, each one differs by the suffix on the API call seen in URL. There are no functions and nothing is return the code is to be run continuously on a <code>while True</code> loop </p>