Sometimes you need to pass command-line flags to the subprocess to tell it to be interactive even though it doesn't look like it's being run in a regular terminal. For example, when running `python` as in the above example, you must pass both `-u` (unbuffered output) and `-i` (interactive mode).
This assumes a shell-like process that reads its input in the usual way. It's not compatible with full-screen terminal apps like emacs or vim, and sometimes it doesn't work with apps that try to do something special for password input. For that you'd need something that can create a pseudo-terminal (I don't have any experience with this, but `tty` and `pty` are good keywords to search for)
-Ben