import subprocess import os import signal import time path = os.path.abspath(__file__).rpartition('/')[0] child_comm = ['python %s/child.py' % path] parent_comm = ['python %s/parent.py' % path] proc = subprocess.Popen(child_comm, shell=True) print 'New child process created' your_condition = True while your_condition: time.sleep(1) subprocess.Popen(parent_comm, shell=True, preexec_fn=os.setpgrp) print 'New wrapper(parent process) created' print 'Terminating old processgroup...' os.killpg(os.getpgid(proc.pid), signal.SIGTERM)