Question: Importing the same module under different names

Andreas Jung andreas at
Mon Jun 3 19:52:58 CEST 2002

Usually Python imports a module 'foo' only once when one uses
multiple 'import foo' statements. However Python load the 
module when one uses packages e.g.


When PYTHONPATH is set to the 'packages' directory then

import foo


import foo
from packages import foo

loads the foo module twice. How does Python determine in this case
to load the module or not?


More information about the Python-list mailing list