Python Vérifiez si la variable est module
from types import ModuleType
isinstance(obj, ModuleType)
Thoughtful Toad
from types import ModuleType
isinstance(obj, ModuleType)