Say I have a module, we'll call it "my_imported_mod". It contains a function 
in it that calls another function, "myfun". The "myfun" function is in the 
module "my_main_mod", that imports "my_imported_mod".

The code of "my_main_mod" might look like this:
==============
from my_imported_mod import *

def myfun():
  print "stuff"
==============

the code of "my_imported_mod" might look like this:
==============
def somefun():
  myfun()
==============

When trying to execute the function somefun(), I get a
NameError: global name 'myfun' is not defined

How to rectify this with minimal code change? How to let imported modules know 
about the namespace they are getting imported into? I do not want to 
restructure my code right now.

Thanks in advance for help.

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

Reply via email to