def kill_process(pid): pgrp = os.getpgid(pid) os.killpg(pgrp, signal.SIGINT) out = check_output(["ps", "auxf"]) print(out.decode('utf-8'))