[Tutor] referencing external functions

A.T.Hofkamp a.t.hofkamp at tue.nl
Fri Nov 14 14:23:53 CET 2008

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,


def f(n):
   return n + 1


import script1

y = script1.f(3)

(I would suggest to use more meaningful names than scriptX.py)


More information about the Tutor mailing list