How to call a method via a variable in threading?

Viewed 335

I'm using the threading class in Python... The variable device is a list of objects. Am I somehow able to convert a 'string' of a variable to translate into a method such that the threading class understands it?

def thread():
    var_string = 'some_func'
    index = 0
    some_thread = threading.Thread(target=device[index].<var_string> , args=())

So essentially, I would like to call device[index].somefunc()

Any help would be greatly appreciated!

2 Answers
Related