[Tutor] OK real basic problem ...

Dave S pythontut at pusspaws.net
Thu Mar 11 08:47:16 EST 2004


I've created a file called pycode ...

#!/usr/bin/env python
print "hi my module is loaded !!!\n"

def addit(a,b):
        print a+b

good so far, chmod a+x pycode

In python I have ...

>>> import pycode
>>> reload(pycode)
hi my module is loaded !!!

<module 'pycode' from '/home/dave/pycode/pycode.py'>
>>> addit(1,2)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'addit' is not defined
>>>

 From my message "hi my module has loaded ... I thought addit() would
work ..

OK I know this is simple ... but ... err .. any ideas

Dave




More information about the Tutor mailing list