[Tutor] calling user defined function
bob gailer
bgailer at gmail.com
Sun Feb 22 23:10:15 CET 2009
roberto wrote:
> hello
> i have a question which i didn't solved yet:
> i can define a function using the text editor provided by IDLE 3.0;
> then i'd like to call this function from the python prompt
>
> but when i try to do it, python warns me that function doesn't exist
> of course if i define the function directly using the >>> prompt,
> after that everything is fine
>
> may you tell me where i have to save the file that defines the
> function is order to use it later ?
> is it a problem of path ?
>
Let's say you saved the file as foo.py. Then:
>>> import foo
>>> foo.afunction()
--
Bob Gailer
Chapel Hill NC
919-636-4239
More information about the Tutor
mailing list