title: How to interact with subprocess that requires input in python?
body: <p>I'm running a subprocess in python with</p>
  <pre class="lang-py prettyprint-override"><code>data = subprocess.run(
      command, 
      shell=True,
      stderr=subprocess.STDOUT,
      text=True
  )
  </code></pre>
  <p>however, some of these commands require input from the user. For example, if I were to run</p>
  <pre class="lang-py prettyprint-override"><code>data = subprocess.run(
      &quot;&quot;&quot;python -c 'input(&quot;What is your input?&quot;)'&quot;&quot;&quot;, 
      shell=True,
      stderr=subprocess.STDOUT,
      text=True
  )
  </code></pre>
  <p>it would hang. For the commands that would be run, there is a way to not accept any input, however that may damage some of the internals since it then has to make assumptions (which are usually wrong). I would like to be able to stream the output to a function as it is generated, as well as be able to pipe in input as it is asked for within the subprocess's run cycle.</p>
  <p>However, I've no clue how to do this. If someone could guide me in the right direction, I'd be eternally grateful!</p>