title: Persistent python subprocess
body: <p>Is there a way to make a subprocess call in python "persistent"? I'm calling a program that takes a while to load multiple times. So it would be great if I could just leave that program open and communicate with it without killing it.</p>
  
  <p>The cartoon version of my python script looks like this:</p>
  
  <pre><code>for text in textcollection:
      myprocess = subprocess.Popen(["myexecutable"],
                  stdin = subprocess.PIPE, stdout = subprocess.PIPE,
                  stderr = None)
      myoutputtext, err = myprocess.communicate(input=text)
  </code></pre>
  
  <p>I need to process each text separately, so joining it all into one large text file and processing it once is not an option.</p>
  
  <p>Preferably, if there's an option like this</p>
  
  <pre><code>myprocess = subprocess.Popen(["myexecutable"],
              stdin = subprocess.PIPE, stdout = subprocess.PIPE,
              stderr = None)    for text in textcollection:
  for text in textcollection:
      myoutputtext, err = myprocess.communicate(input=text)
  </code></pre>
  
  <p>where I can leave the process open, I'd really appreciate it.</p>