It is always "possible." Wether is another story.
A quick and dirty way to do this is to iterate through all the classes sequentially and check if any attributes you have are defined. Of course, this is due to conflicts, and this will give the first class that has such a named attribute. If it exists in more than one, it's up to you what you want:
def finder(attr): for cls in object.__subclasses__(): if hasattr(cls, attr): return cls raise ValueError
Instead of searching in "globals", it searches for all subclasses of "object" - so the classes that should be found should not be in the module namespace where the finder function is.
If your methods are unique in the set of classes you are looking for, perhaps you can just collect a mapping of all the methods and use them to call them.
Suppose all your inehrit classes are from a class named "Base":
mapper = {attr_name:getattr(cls, attr_name) for cls in base.__subclasses__() for attr_name, obj in cls.__dict__.items() if isinstance(obj, classmethod) }
And you call them using mapper['attrname']()
This avoids a linear search every time the method is called, and therefore will be much better.
- EDIT -
__subclassess__ just find direct subclasses of the class, not the inheritance tree, so it will not be useful in "real life" - it may be in the specific case, which has OP in its hands.
If you need to find things in the inheritance tree, you must also review each subclass.
As for the old-style classes: this, of course, will not work - this is one of the motives for which, by default, they are applied differently in the new code.
As with attributes other than the class: they can only be found to test instances anyway, so you need to think about a different method - here, apparently, is not an OP problem