How to start threads at the same time in Python [duplicate]

I don’t know if it’s the only problem with your code, but I can tell about threading — target has to be a function, instead you call functions, making them run in main thread. So if first function is an infinite loop — program will not create any threads, because it will stuck executing the first function. Here is how you do it:

t1 = threading.Thread(target=create_window)
t2 = threading.Thread(target=play_song)
t3 = threading.Thread(target=mouse_move)

Leave a Comment