That should be:
module = import_module("modules.uberModule.uberModule")
unless uberModule/__init__.py
imports the contents of uberModule
(I guess not)
Pergunta
I am trying to import a uberModule and retrieve the class "test" but getattr can't find it, why ? Thanks.
AttributeError: 'module' object has no attribute 'test'
Here's my code, main.py:
from importlib import import_module
module = import_module("modules.uberModule")
cls = getattr(module, 'test')
uberModule.py :
class test():
def __init__(self):
print "such wow"
Directory structure :
.
├── modules
│ ├── __init__.py
│ └── uberModule
│ ├── __init__.py
│ └── uberModule.py
├── __init__.py
├── main.py
Solução
That should be:
module = import_module("modules.uberModule.uberModule")
unless uberModule/__init__.py
imports the contents of uberModule
(I guess not)