Can importlib import more than one module at a time in Python 2.7? -
i need import 2 modules (determined @ runtime) in same bundle , wondering if done 1 import_module command.
basically, want equivalent of
from some_package import module1, module2 ways it:
callimport_module 1 time each module have __init__.py import 2 modules, import package use __import__, doesn't utilize importlib , discouraged docs. there more ways this. can done single phone call import_module? failing that, there way considered standard way?
one call? not. can do:
for module in modules: importlib.import_module(module) or:
map(importlib.import_module, module) why matter if it's more 1 call? internal implementation of ways import serial , individual 'calls' either way.
python python-2.7 python-importlib
No comments:
Post a Comment