Let's say I have a program as such:
import threading
def dosomething():
print "Something"
class thread2(threading.Thread):
def run():
dosomething()
thread2().start()
would dosomething() run from the main thread, where it was defined, or thread2, where it was called?
I'm using this for a pygame program, since you can't call pygame's methods from multiple classes.
It doesn't matter where you declared the function. The function is going to be executed by the thread that calls it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With