Python Vérifiez si la variable est module

from types import ModuleType

isinstance(obj, ModuleType)
Thoughtful Toad