Edward Elliott <[EMAIL PROTECTED]> wrote:

> [EMAIL PROTECTED] wrote:
> > Basically my application has a scheduler which stores names of functions
> > defined in the "schedule" module in a database, to be run on certain
> > days.  Every night I call schedule.RunSchedule, which grabs all the rows on
> > the database that have to be run now, and I want to call the function
> > defined the same module according to that string.
> 
> I know that sys.modules[__name__] gives the module object for the current
> module.  You could do:
> 
> m = sys.modules[__name__]  # M now current module object
> func = m.__dict__ [fs]     # func has function named by string fs
> func()

sys.modules[__name__].__dict__ may be more handily accessed by the
built-in function globals().


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

Reply via email to