If I have a program like this:
for i in range (25000):
do something
if i == 5000:
run new_script.py in a new thread/process
continue as before
How can I do this?
If I have a program like this:
for i in range (25000):
do something
if i == 5000:
run new_script.py in a new thread/process
continue as before
How can I do this?
Put the content of new_script.py in a function and import it
from threading import Thread
from new_script import f
for i in range (25000):
do_something()
if i == 5000:
Thread(target=f, args=(arg1, arg2)).start()