I want to get a list of classes in my class. According to this answer How to find all the subclasses of a class given its name? I should be able to use cls.__subclasses__
, but this function does not exist.
I tried the answer to question How to find all the subclasses of a class given its name?
class X:
class my_subclass:
pass
x=X()
x.__subclassess__()
# This reports AttributeError 'X' has no attribute '__subclasses__'
I would expect to get a dictionary object or the like. But I just get an error message AttributeError 'X' has no attribute '__subclasses__'
.