What I am doing is importing modules that have an identical instance
name. So I say:

import Grid

Grid has its instance:

Grid.Grid()

and this is the same for all modules of my webapp.
allowedPages is a list of modules to import, so they are quoted
strings:

for page in self.allowedPages:
   setattr(self, page, __import__(page))

The problem is that the attribute name needs to reference the
Grid.Grid instance and not the Grid module. How would I do this?
I can do it literally:
setattr(self, 'Grid', Grid.Grid)

however doing it as a reference eludes me.

Or is there some nifty Pythonic way of bulk importing modules?

--  Gnarlie
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to