I have a question regarding subprocess.Popen .I'm calling a shell script and provide fewinputs. After few inputs ,I want user running the python script to input.
Is it possible to transfer control from Popen process to command line.
I've added sample scripts
sample.sh
echo "hi"
read input_var
echo "hello" $input_var
read input_var1
echo "Whats up" $input_var1
read input_var2
echo "Tell something else" $input_var2
test.py
import os
from subprocess import Popen, PIPE
p=Popen([path to sample.sh],stdin=PIPE)
#sample.sh prints asks for input
p.stdin.write("a\n")
#Prompts for input
p.stdin.write("nothing much\n")
#After the above statement ,User should be able to prompt input
#Is it possible to transfer control from Popen to command line
Output of the program python test.py
hi
hello a
Whats up b
Tell something else
Please suggest if any alternate methods available to solve this