importing modules dynamicly

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Jan 11 01:11:00 EST 2011


On Mon, 10 Jan 2011 20:42:17 -0800, dubux wrote:

> After loading all the modules, i try to do something like:
> 
> instance = modules.modulename.class()

No you don't. class is a reserved word in Python, you would get a 
SyntaxError if you did that.

Please post the error you get, including the complete traceback, showing 
the line of code that fails. Copy and paste the *actual* message in full, 
don't retype it from memory, paraphrase it, simplify it, translate it 
into Swahili, or otherwise change it in anyway.



-- 
Steven



More information about the Python-list mailing list