You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import importlib
module_names = [('math',), ('numpy','np')]
def Importer(m_name):
module = importlib.import_module(m_name[0])
if len(m_name) > 1:
globals()[x[1]] = module
for x in module_names:
Importer(x)
names = getattr(foo, '__all__', [])
if not names:
names = [n for n in foo.__dict__.keys() if n[:1] != '_']
for name in names:
globals()[name] = getattr(foo, name)
The text was updated successfully, but these errors were encountered:
import different backends with same alias
https://stackoverflow.com/questions/72106437/dynamically-assigning-module-names-as-aliases
The text was updated successfully, but these errors were encountered: