You can use the subprocess module and Popen.communicate() to send data to the stdin process
EDIT:
You're right, it should use stdin.write to send data, something like this:
#!/usr/bin/env python import subprocess import time print 'Launching new process...' p = subprocess.Popen(['python', 'so1.py'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) print 'Sending "something"...' p.stdin.write('something\n') print 'Waiting 30s...' time.sleep(30) print 'Sending "done"...' p.stdin.write('done\n') p.communicate() print '=o='
source share