I have a program that starts a new thread to run another arbitrary process. My issue is that the name of the function used for the thread is stored inside a variable. My code:
import _thread
def ArbitraryFunction():
#do function
userIn = "ArbitraryFunction"
try:
_thread.start_new_thread( userIn, ("Thread-1") )
except:
print("Failed to start thread.")
I get an error every time I run this code, indicating that I have not specified a function. However the function name is specified, it is simply contained within a variable.
What have I done wrong, and what do I need to do to fix it? Any help would be greatly appreciated!