A reasonable way to interact any command line program
```
import pexpect
process = pexpect.spawn('python')
while 1:
outputs = ''
try:
while 1:
char = process.read_nonblocking(timeout=1)
outputs += char.decode('utf-8')
except pexpect.TIMEOUT:
print(outputs)
process.send(input("What you wanna do? ") + "\n")
```
https://terminallabs.com/blog/a-better-cli-passthrough-in-python/
import pexpect
process = pexpect.spawn('python')
while 1:
outputs = ''
try:
while 1:
char = process.read_nonblocking(timeout=1)
outputs += char.decode('utf-8')
except pexpect.TIMEOUT:
print(outputs)
process.send(input("What you wanna do? ") + "\n")
```
https://terminallabs.com/blog/a-better-cli-passthrough-in-python/