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?
import subprocess
subprocess.call(['./testprg'])
# testprg will open its own shell
# so the code below will not work
subprocess.call(['i 2'])
testprg is another program which open a shell prompt. Enter "i 2" will trigger a "insert" command with the value 2.