Skip to content

Instantly share code, notes, and snippets.

@jonatan1609
Created March 14, 2021 16:09
Show Gist options
  • Save jonatan1609/1699b00f4531dcb87bdf2b90ff782777 to your computer and use it in GitHub Desktop.
Save jonatan1609/1699b00f4531dcb87bdf2b90ff782777 to your computer and use it in GitHub Desktop.
only run a.py by `python a.py`
from subprocess import Popen
from signal import SIGKILL
from threading import Thread
def sleep(n):
from time import sleep
sleep(n)
process = Popen("python b.py", shell=True)
Thread(target=process.wait).start()
sleep(5)
process.send_signal(SIGKILL)
from time import sleep
from itertools import count
for i in count():
print(i)
sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment