Question about importing modules

pythos pythos
Sat Aug 21 14:59:36 EDT 2004


Newbie at python (but not programming) here...

I have a program that has "import os" at the top, and then later a call to
utime() is made.  The python interpreter says "name 'utime' is not defined".
But if I change "utime(...)" to "os.utime(...)" then it works fine.  Perhaps I
am expecting the "import os" statement to work the same way as "import
<package_name>.*" does in Java.  So is it the case that if I write "import os"
in python, then I still need to write "os.utime(...)"?  Or is there something
else wrong?  Thanks.




More information about the Python-list mailing list