title: How can I spawn new shells to run Python scripts from a base Python script?
body: <p>I have successfully run several Python scripts, calling them from a base script using the subprocess module:</p>
  
  <pre><code>subprocess.popen([sys.executable, 'script.py'], shell=True)
  </code></pre>
  
  <p>However, each of these scripts executes some simulations (.exe files from a C++ application) that generate some output to the shell. All these outputs are written to the base shell from where I've launched those scripts. I'd like to generate a new shell for each script. I've tried to generate new shells using the <code>shell=True</code> attribute when calling subprocess.call (also tried with popen), but it doesn't work.</p>
  
  <p>How do I get a new shell for each process generated with the subprocess.call?</p>
  
  <p>I was reading the documentation about stdin and stdout as suggested by Spencer and found a flag the solved the problem: subprocess.CREATE_NEW_CONSOLE. Maybe redirecting the pipes does the job too, but this seems to be the simplest solution (at least for this specific problem). I've just tested it and worked perfectly:</p>
  
  <pre><code>subprocess.popen([sys.executable, 'script.py'], creationflags = subprocess.CREATE_NEW_CONSOLE)
  </code></pre>