I'm having trouble with the following code:
def get_module(mod_path):
mod_list = mod_path.split('.')
mod = __import__(mod_list.pop(0))
while mod_list:
mod = getattr(mod, mod_list.pop(0))
return mod
When I do get_module('qmbpmn.common.db_parsers')
I get the error message:
AttributeError: 'module' object has no attribute 'db_parsers'
.
However: import qmbpmn.common.db_parsers
works perfectly fine.