title: How to chain multiple command line responses in Python?
body: <p>I've been trying to run a script within another python script with no luck. </p>
  
  <p>The script I am trying to run is garminbackup.py which can be found in the following repo. </p>
  
  <p><a href="https://github.com/petergardfjall/garminexport" rel="noreferrer">https://github.com/petergardfjall/garminexport</a></p>
  
  <p>When you run this script from the command line it asks you for some information, username, location to save files, ect... </p>
  
  <pre><code>command = 'python garminbackup.py --backup-dir=Name email --format tcx'
  </code></pre>
  
  <p>It then asks for a password, and once entered it starts to download the garmin files to the directory provided. My goal is to create a program which loops through multiple accounts and updates the data in each folder. </p>
  
  <p>My issue is that I cannot seem to get the subprocess module in python to performance this.  </p>
  
  <p>I've tried the following command with no luck. It seems to get stuck on the enter password input screen and does not do anything else. </p>
  
  <pre><code>import subprocess,shlex
  from subprocess import PIPE,call
  import os
  
  p = subprocess.Popen(command,stdout=subprocess.PIPE,stdin=subprocess.PIPE,shell=True)
  p.stdin.write("password\n")
  p.wait()
  </code></pre>
  
  <p>I've searched for hours with little luck. Any help is appreciated. </p>