Use update
for dicts:
globals().update(importlib.import_module('some.package').__dict__)
Note, that using a_module.__dict__
is not the same as from a_module import *
, because all names are “imported”, not only those from __all__
or not starting with _
.