Newbie: problem with own module
Matthias Stern
mstern at aon.at
Thu Feb 20 01:09:50 EST 2003
Hi! I have problems building my own modules. This is the a short version
of the program with all functions (i show here only one) in one file:
---
import WS
def init(name):
:
WS.SetRunMode(1)
:
:
:
def main():
init(something)
main()
---
Now I want to put all the functions like "init()" except main() into a
module. this look like:
module "boo.py":
---
def init(name):
:
WS.SetRunMode(1)
:
---
main program:
---
import WS
import boo
def main():
boo.init(something)
main()
---
When I try to run this IDLE reports:
File "<snip>\boo.py", line 12, in init
WS.SetRunMode(1)
NameError: global name 'WS' is not defined
I tried to set a "import WS" command into file boo.py, too. But it didn't
help. What am I doing wrong?
Thx, Mac
More information about the Python-list
mailing list