Hello. There are 2 functions. The look() function will periodically send a request to the server and wait for the desired response. The doing() function will be launched if the required response is received.

The goal is for the doing() function to work in parallel (its work can take a day) and many doing() functions can work in parallel at once without interfering with the work of the look() function

 import time def doing(): print('Делаем что-то') time.sleep(60) def look(): while True: print('Ищем что-то') if # что-то найдено: doing() 

2 answers 2

 import threading import time def doing(): print('Делаем что-то') time.sleep(60) def look(): while True: print('Ищем что-то') if # что-то найдено: thread = threading.Thread(target = doing) thread.start() 
  • Thank you for what you need! - JSer1
 import time import threading def doing(): print('Делаем что-то') time.sleep(60) def look(): while True: print('Ищем что-то') if # что-то найдено: start_th = threading.Thread(target = doing) start_th.start()