[Tutor] How to import one function from another program (not as header)

Hanna Joo hanna@chagford.com
Thu, 23 Aug 2001 22:17:07 +0200


Hi

I have two programs. I would like to import a function from another program
but want to pass name of the function as a variable. Is this possible?

prog a:

def something(modulename, funcName):
    module = __import__(modulename)
    func = module.funcName    ( == doesn't work.. complains that module has
no attribute 'funcName')

I would like to keep funcName as a variable.. How can I do this?
Any help will be appreciated.

TIA

Hanna