[Tutor] referencing external functions
bob gailer
bgailer at gmail.com
Fri Nov 14 14:30:05 CET 2008
A.T.Hofkamp wrote:
> Robert Berman wrote:
>> I have a number of functions written in a python script called
>> script1.py. In another script, script2.py, I need to use a number of
>> the functions residing in script1.py. How do I make these functions
>> known to script2.py.
>>
>> Thank you,
>
> script1.py:
>
> def f(n):
> return n + 1
>
>
>
> script2.py:
>
> import script1
>
> y = script1.f(3)
>
>
> (I would suggest to use more meaningful names than scriptX.py)
Perhaps Robert uses (as I do) Python for Windows. "Save" proposes
script1, script2, ... as the initial filename.
WIBNI it could cleverly guess a meaningful name as Word attempts to?
Bob Gailer
Chapel Hill NC
919-636-4239
When we take the time to be aware of our feelings and
needs we have more satisfying interatctions with others.
Nonviolent Communication provides tools for this awareness.
As a coach and trainer I can assist you in learning this process.
What is YOUR biggest relationship challenge?
More information about the Tutor
mailing list