J'éprouve des difficultés avec le code suivant:Importation dynamique en Python (de statments pointillées)
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
Quand je get_module('qmbpmn.common.db_parsers')
je reçois le message d'erreur: AttributeError: 'module' object has no attribute 'db_parsers'
. Cependant, import qmbpmn.common.db_parsers
fonctionne parfaitement bien.