I got the following files architecture:
[X] publisher/
[X] __init__.py (containing Publisher(Object), an abstractclass)
[X] mail.py (containing class Mail(Publisher))
[X] simple.py (containing class Simple(Publisher))
[X] ftp.py (containing class Ftp(Publisher))
[X] app.py
In app.py I got this dictionary :
publisher_to_load = ["Mail","Mail","Simple"]
I would like to instanciate, for each publisher_to_load
, the corresponding publisher.
I tried :
import publisher
for name in publisher_to_load:
getattr(publisher, name)()
But I got the error
AttributeError: 'module' object has no attribute 'Simple'
Any idea ?