[Tutor] Useing Functions
python_newbie at vedorian.com
Sat Aug 21 04:10:18 CEST 2004
Ok I know exactly what I did wrong with that when I put in: import define, I
did not call it right instead of define.YesNo(x,y) I was calling it just
Thats why it was working with from define import YesNo
----- Original Message -----
From: "Alan Gauld" <alan.gauld at blueyonder.co.uk>
To: "Kevin" <python_newbie at vedorian.com>; "Python" <tutor at python.org>
Sent: Friday, August 20, 2004 4:10 PM
Subject: Re: [Tutor] Useing Functions
> > I mande a simple module called define.py just to try it out. However
> > put import defines in the main file I get an error: Traceback
> (most recent
> > call last):
> > File "C:\WINDOWS\Desktop\files\python\test.py", line 5, in ?
> > YesNo(x, y)
> > NameError: name 'YesNo' is not defined
> > however when I put from define import YesNo
> > it works fine. Why will it not work in the ladder half?
> Without seeing the code that causes the error I can only guess.
> Did you remember to precede your function with the module name?
> import defines
> Have a look at my modules and functions topic in my tuor it
> covers how to create functions and modules and use them.
> Alan G
> Author of the Learn to Program web tutor
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.740 / Virus Database: 494 - Release Date: 8/16/04
More information about the Tutor