Python - open a command which open another shell
<p>I am writing a Python code which calls a command line (e.g. python itself) and the command will open its own shell. How can Python take control of this shell?</p>

<pre><code>import subprocess
subprocess.call(['./testprg'])

# testprg will open its own shell 
# so the code below will not work
subprocess.call(['i 2'])
</code></pre>

<p>testprg is another program which open a shell prompt. Enter "i 2" will trigger a "insert" command with the value 2.</p>
