Scope question
MDK
mdk at mdk.com
Thu Feb 7 10:26:02 EST 2002
I have this:
# myprog.py
from mymod import *
def dosomething(x):
dosomething(1000)
# End code
I want the dosomething(1000) run from the function in mymod. However,
instead it is running dosomething(x) in myprog.py.
Note: Changing the names of dosomething() in either module is not an option.
(The names depicted here are not the real names in the program but have been
changed for clarity.)
I know that one way to fix this is to change
from mymod import *
to
import mymod
But I would like to know if, without changing the import line, there is a
way to tell Python to use the dosomething() from mymod.
I tried mymod.dosomething(1000) but it returns an error:
AttributeError: 'builtin_function_or_method' object has no attribute
'dosomething'
Thanks!
More information about the Python-list
mailing list