import and package confusion

Dale Amon amon at vnl.com
Wed Apr 29 19:52:34 CEST 2009


I am going around in circles right now and have to
admit I do not understand what is going on with
import of hierarchical packages/modules. Perhaps someone
can get me on the road again. Here is a subset of what I 
am trying to accomplish:

The package directory set up:

	VLMLegacy/
          __init__.py
          Reader.py
	  Conditions.py
          VLM4997/
            __init__.py
            Conditions.py
          WINGTL/
            __init__.py
            Conditions.py

The inheritance:

	object
          Reader
            Conditions
              VLM4997.Conditions
              WINGTL.Conditions


Now how do I use import or from to be able to 
use these modules? The following is not 'real'
code and is only intended to give some idea of
what I am trying to accomplish:

import sys
sys.path.extend (['../lib', '../bin'])

import VLMLegacy.VLM4997.Conditions
import VLMLegacy.WINGTL.Conditions

b = VLM4997.Conditions(2)
b.test()

c = WINGTL.Conditions(2)
c.test()

And of course note that both of those must inherit
VLMLegacy.Conditions().

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20090429/d7375f83/attachment.sig>


More information about the Python-list mailing list