python open multiple threads code example
Example: python running multiple threads at the same time
from threading import Thread
from time import sleep
# use Thread to run def in background
# Example:
def func1():
while True:
sleep(1)
print("Working")
def func2():
while True:
sleep(2)
print("Working2")
if __name__ == '__main__':
Thread(target = func1).start()
Thread(target = func2).start()