How to run script from interpreter?

JustinHJ justinhj at hotmail.com
Fri Jan 19 13:19:26 EST 2001


A cool thing I found out solving my own problem is that a module can be a
variable. So you want to run a module called 'bobsmodule'

    str = 'bobsmodule'

    fp, pathname, description = imp.find_module( modname )

    print 'importing module', modname
    LoadedModule = imp.load_module( modname, fp, pathname, description)
    LoadedModule.Afunctioninbobsmodule(i)

This gives you flexibility if you need it.






More information about the Python-list mailing list