title: Open an .exe file and give it input parameters in Python
body: <p>I'm trying to open an .exe file from Python and give it some instructions. This .exe file has its own "language" so, for example, in order to launch a model I should type "call ". Because I have thousands models to run I need to automatize the process. </p>
  
  <p>Here on Stackoverflow I found several options that I tried. Even though I don't get any error, my .exe file doesn't run (actually a window opens and closes immediately). I'm writing one of these solutions.  [I'm using Python3]:</p>
  
  <pre><code>from subprocess import Popen, PIPE
  
  p = Popen(["my_file.exe"], stdin=PIPE, stdout=PIPE)  
  output = p.communicate(input=b"call test.m")      # "call test.m" is the way to run a model in my_file.exe
  </code></pre>
  
  <p>From this simple code I want "just" 'type' in an automatic way in my program "call .m", but it doesn't work. </p>
  
  <p>Can anyone help me?
  Thanks</p>