Here is a snippet taken from one of the examples where you can write to the stdin of the spawned process (you can do something similar for reading from stdout as well):Ĭode: Select all proc = subprocess.Popen(, stdin=subprocess.PIPE) It covers writing to and reading from stdin and stdout of a subprocess:
This is the Python 2.7 documentation for the subprocess module: Īnd I think this site has a great writeup with some examples on using the module. You can spawn a new process from Python 2.7 code (to run your Python 3 script) and set it up such that the stdin and stdout can be read and written to.
I don't have any of my own examples I can provide, but are you familiar with the subprocess module in Python? It sounds like that may be what you want.