title: Executing commands from Python script
body: <p>I am working on automation of flashing process of a development board.
  I have an command line flashing tool which allows me to execute various commands required for flashing the board.</p>
  
  <p>I am trying automate the same with a Python script.
  I am using subProcess.Popen to start the .exe and then I need to execute other commands.
  I have posted below the sudo code:</p>
  
  <ol>
  <li><code>process = subprocess.Popen(filename.exe, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)</code></li>
  <li><code>process.communicate(arg)</code>
  I also tried with </li>
  <li><code>subProcess.stdin(arg)</code></li>
  </ol>
  
  <p>But I am not able to get desired result. 
  I tried with creating batch file and then running it form Python but no luck there too. It just starts the exe and then closes it.</p>
  
  <p>Can any one help me in solving this issue. I have just started with Python scripting so please help me out.</p>