I need to open a thread whose target is defined in a different file.
I would like to pass the target name through a string containing, of course, the name of the function I want to run on thread. Is that impossible, or am I missing something?
For instance, here is my code:
Here is the code that has the target function:
# command.py
def hello():
print("hello world")
and here is the code I will run:
# run.py
import threading
import commands
funcname = "hello"
thread1 = threading.Thread(target= ... , daemon=True)
thread1.start()
What do i need to put as target?