indirect import of standard module

BartlebyScrivener rpdooling at gmail.com
Tue Apr 18 14:50:00 EDT 2006


I know this must have been answered a hundred times, but I must be
searching on the wrong terminology.

Let's say I have a module foo.py that imports os.

I make another script called bar.py that imports foo.py and now I want
to use, say, os.walk in bar.py.

Which is faster or more correct or whatever: Do I import os at the top
of bar.py and use foo's functions?

Or do I call os.walk by writing foo.os.walk?

Sorry for lack of proper terminology. I read the module parts of the
Tutorial but couldn't find it there.

Rick




More information about the Python-list mailing list