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.
I'm currently playing around with this script:
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
Each python script it trys to run is simple (for testing purposes)
import time
for i in range(50):
print i
time.timer(1)
Is this correct ? is this running each script ? It runs with no errors
('', None)
('', None)
[Finished in 0.3s]
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?
EDIT: the scripts i'm running are in different folders here is a pastebin for the actual scripts , 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 while True loop