To explain my reasoning, this scheme will allow me to run the script three ways, as shell, as one-shot CGI or as a persistent mod_wsgi module.
So to be more exhaustive: In __init__ I can say: import Grid self.Grid = Grid.Grid self.Grid is now the instance of Grid inside the module Grid. then later on I __call__ with the input data: html=self.Grid(queryString, environ) and this works great for one module, a default output which is now running on my server. But now I want to use the query string to load the instance, which means it comes in as text. Say I load a list of modules: allowedPages=['Gnomon', 'Grid', 'Lexicon', 'Harmonics'] I need to import them all at __init__, and set the instance for each like this: self.Gnomon=Gnomon.Gnomon self.Grid=Grid.Grid self.Lexicon=Lexicon.Lexicon self.Harmonics=Harmonics.Harmonics Then dynamically, in __call_, I just use the CGI string to invoke my target object. What I have now is: self.modules = {} page = 'Gnomon' self.modules[page] = __import__(page) which gives me <module 'Gnomon' from '~/Sites/Sectrum/Gnomon.py'> A solution is to set self.modules[page] to the Gnomon instance of the Gnomon module. How to? -- Gnarlie http://Sectrum.com -- http://mail.python.org/mailman/listinfo/python-list