I have a complicated folder structure that contains many files in folders and sub-folders. I would like to generate a list of all classes that inherit for the "experiment" class so that I can import them. again only if they inherit from the class experiment.
I tried this:
import inspect
for name, obj in inspect.getmembers(sys.modules[__name__]):
if inspect.isclass(obj):
print(obj)
It prints all classes and I suppose I could check them later on but it doesnt iterate over all folders and subfolders, just looks in the top level. I could use os.walk
but is there an easier way?