import question

kopfarzt at my-deja.com kopfarzt at my-deja.com
Fri Nov 3 06:01:07 EST 2000


Hi,

how can I dynamically import modules in function
a() , and then call them by name in function b()
instead of using the module object?

what I want to do is something like this:

def a():
  module = __import__ ('foo')

def b():
  x = eval ('foo.bar ()')

I always get a NameError: foo
(I am using Python 1.5.2)

Thanks in advance for any replies!
Peter


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list