I'm wondering if it's possible in Python to find a method in a different function by using it's string name.
In one function, I pass in a method:
def register(methods): for m in methods: messageType = m.__name__ python_client_socket.send(messageType) register(Foo) In a different method that takes in the string that was sent over, I want to be able to associate a number with the method in a dictionary ( i.e. methodDict = {1: Foo, 2:Bar, etc...} )
Is there a way in Python to find the method from the string?