1from threading import Thread
2from time import sleep
3# use Thread to run def in background
4# Example:
5def func1():
6 while True:
7 sleep(1)
8 print("Working")
9
10def func2():
11 while True:
12 sleep(2)
13 print("Working2")
14
15if __name__ == '__main__':
16 Thread(target = func1).start()
17 Thread(target = func2).start()