Given a string of a Python class, e.g. my_package.my_module.MyClass
, what is the best possible way to load it?
In other words I am looking for a equivalent Class.forName()
in Java, function in Python. It needs to work on Google App Engine.
Preferably this would be a function that accepts the FQN of the class as a string, and returns a reference to the class:
my_class = load_class('my_package.my_module.MyClass')
my_instance = my_class()