while(True): gen = subprocess.Popen(['python', 't1.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) start = subprocess.Popen(['python','t3.py'], stdin=gen.stdout, stdout=subprocess.PIPE) stdout, stderr = start.communicate() print stdout