Starting with a class like this:
class FooClass(object):
@staticmethod
def static_method(x):
print x
normally, I would call the static method of the class with:
FooClass.static_method('bar')
Is it possible to invoke this static method having just the class name and the method name?
class_name = 'FooClass'
method_name = 'static_method'
You shouldn’t mess with locals() as suggested in other answers. If you have your classname as a string and need to resolve it, use registry of some sort. A dictionary will work fine. E.g.
(I assume you will want to add many more classes to this registry)
the lookup then becomes almost trivial: