I am starting a script in a new PowerShell window from python and I'd like to let that process run in the background, so I can interact with it continuously.
I've tried with the following code:
p = subprocess.Popen(['start powershell.exe', '-File', 'script.ps1']
shell = True,
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
bufsize = 1,
encoding ='utf-8')
p.stdin.write('input1')
p.stdout.readline()
p.stdin.write('input2')
p.stdout.readline()
p.stdin.write('input3')
p.stdout.readline()
But p.stdin.write does nothing. How can I solve this problem?