dynamically load from module import xxx

Neal Becker ndbecker2 at gmail.com
Tue Jul 1 17:11:59 CEST 2008


What is a good way to emulate:

from module import xxx
where 'module' is a dynamically generated string?

__import__ ('modulename', fromlist=['xxx'])

seems to be what I want, but then it seems 'xxx' is not placed in globals()
(which makes me wonder, what exactly did fromlist do?)




More information about the Python-list mailing list