[Tutor] Interpackage access help-Please disregard other post with same name
Kent Johnson
kent37 at tds.net
Mon Feb 13 21:42:59 CET 2006
Francesco A. Queirolo wrote:
> Sorry about the double post but the first one was sent before I was
> completed with my question.
>
> I have the following directory structure on Windows XP running python
> 2.4.2 final:
>
> JavaInheritancePoly\
> HierarchicalInheritancePoly.py
> Animals\
> __init__.py
> Modules\
> __init__.py
> Animal.py
> Test\
> __init__.py
> AnimalTest.py
>
> When in AnimalTest.py I would like to access animal. I have tried:
>
> from JavaInheritancePoly.Animals.Modules import Animal
For the above to work you need __init__.py in JavaInheritancePoly\ and
the dir containing JavaInheritancePoly\ must be in sys.path either
because it is in the working directory or some other means.
Kent
More information about the Tutor
mailing list