I am opening a process (with os.popen() ) that, for some commands, detects certain keypresses (e.g. ESC - not the character, the key).  Is there a way to send keypress events to the process?
What platform is this on? 
You may have to actually feed events into the event loop, if it's running on Win32.
Python: How do I generate a keypress?