Referencing module.instance
Gnarlodious
gnarlodious at gmail.com
Sat Dec 3 05:37:14 EST 2011
HA! After much experimenting I hit upon getattr(__import__(page), page):
for page in self.allowedPages:
scriptPath = '{}/{}.py'.format(os.path.dirname(__file__), page)
if os.path.exists(scriptPath):
self.modules[page] = getattr(__import__(page), page)
Then in __call_ I just say:
target = incoming CGI variable
self.modules[target](qList, environ)
and it works!
-- Gnarlie
More information about the Python-list
mailing list