Here's one way: def generate(cmd): clsname = cmd + "Generator" g = globals() if g.has_key(clsname): ... globals() returns the module's dict, not the module. You could also import modulename as self but this is a kind of circular import, and the re-use of the name "self" (which will be used in method definitions) smells bad too. Jeff