On Monday, August 22, 2016 at 4:22:09 PM UTC-4, Malcolm Greene wrote: > Python 3.5: Is there a way to dynamically import specific names from a > module vs importing the full module? > > By dynamic I mean via some form of importlib machinery, eg. I'm looking > for the dynamic "from <module> import <name>" equivalent of "import > <module>"'s importlib.import_module. > > Thank you, > Malcolm
You can use: the_mod = importlib.import_module("module") a = the_mod.a b = the_mod.b # or a = getattr(the_mod, 'a') b = getattr(the_mod, 'b') --Ned. -- https://mail.python.org/mailman/listinfo/python-list