#!/usr/bin/python2.5 from subprocess import * import time p = Popen(['./child.py'], stdin=PIPE, stdout=PIPE) time.sleep(5) try: p.stdin.write('haha!\nhehe!\n') p.stdin.flush() except: print p.stderr.read() raise