[Tutor] I think I'm getting ahead of myself

Sean 'Shaleh' Perry shaleh@valinux.com
Thu, 20 Jul 2000 16:54:01 -0700


On Thu, Jul 20, 2000 at 07:31:03PM -0400, Steven Gilmore wrote:
> 
> then I run the script in IDLE
> 
> >>> import test
> >>> countdown(3)
> Traceback (innermost last):
>   File "<pyshell#4>", line 1, in ?
>     countdown(3)
> NameError: countdown
> 
> what's the deal?

I assume you named the script that contains countdown() test.py.  When you
import a module, you have to refer to it as module.object.  So in this case:

test.countdown(3)

otherwise:

from test import countdown
countdown(3)

will work.