import subprocess
child = subprocess.Popen(['python', 'simple.py'], stdin=subprocess.PIPE)
child.communicate('Alice')
I know you can communicate with executed script via communicate How do you check for whether a script 'simple.py' is asking for user input?
simple.py could ask for 5-10 user inputs so simply hardcoding communicate
wouldnt be enough.
[EDIT]: want to parse the stdout as the script is running and communicate back to the script
while True:
if child.get_stdout() == '?':
# send user input