title: Execute commands in Python without closing the CMD shell
body: <p>I'm trying to execute commands sequentially through Python.</p>
  
  <p>My aim is to do something like this:</p>
  
  <pre><code>command1
  calculate something
  command2
  ...
  </code></pre>
  
  <p>I want the CMD to remain opened after executing 'command1' , since 'command2' <strong>is dependent</strong> on 'command1'.</p>
  
  <p>I've tried these answers with no results:</p>
  
  <p>This one gives me the error:</p>
  
  <pre><code>ValueError: write to closed file
  </code></pre>
  
  <p>while executing two communicate commands.</p>
  
  <p><a href="https://stackoverflow.com/questions/46600399/python-popen-how-to-execute-commands-in-nested-sub-shell-using-python">Python Popen - how to execute commands in nested sub shell using python</a></p>
  
  <p><a href="https://stackoverflow.com/questions/359347/execute-commands-sequentially-in-python">Execute Commands Sequentially in Python</a></p>
  
  <p>Thanks in advance!</p>