[Tutor] calling user defined function

roberto roberto03 at gmail.com
Sun Mar 15 12:45:12 CET 2009

On Sun, Feb 22, 2009 at 11:10 PM, bob gailer <bgailer at gmail.com> wrote:
> 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()

thank you very much, the help you provided me works fine

nonetheless, yesterday i met a little problem:
the procedure you indicated me

>>>> import foo
>>>> foo.afunction()

works fine but when i modify the function "afunction" in the file
foo.py then no change occurs when i call it again, i mean the function
behavior is exactely the same as before i made any modification; i
tried to import foo again, but nothing happens, the output of
"foo.afunction" is as if i never made any change to it ...

if you have any suggestion, it is very appreciated

OS: GNU/Linux
       Kubuntu, Edubuntu

More information about the Tutor mailing list