I would like to get a class from another module by its name as string, with the following structure:
> foldera
> folderb1
> folderc
- __init__.py
- folderc.py (parent)
- folderc_childa.py (child)
- ....py (more child implementations)
> folderb2
- __init__.py
- converter.py
- ....py
And would like to getattr
of module folderc
to list all classes of its files (e.g. a list containing classes named FolderC, FolderCChildA, and so on)
Currently getattr(foldera.folderb1.folderc, 'FolderCChildA')
displays that it was not found. Because in the debugger foldera.folderb1.folderc
contains no more classes as attributes than folderc.py
I tried things like this How to get class object from class name string in the same module? but it still is not working. Has anyone any advice where my mistake was made?
Solved: solution import classes into init.py of the module