Cross-reference 'import' in a class hierarchy

Ben Finney bignose-hates-spam at
Mon Apr 7 03:06:06 CEST 2003

Howdy all,

So, I'm fairly experienced with Python for shell programming, fairly
experienced with OO programming, but am just now using the one for the

I'm designing a class hierarchy, using Python package directories for
semi-discrete sets of modules; all Good Things if I understand

However, some of the modules need to refer to modules elsewhere in the
hierarchy, and I can't find how to manage filesystem paths elegantly in
Python 'import' statements.

  Project monty
    |--- Package foo
    |     |--- Module ook
    |     |--- Module eek
    |--- Package bar
          |--- Module ork
          |--- module urk

In I want:

    import eek

How do I set up my paths the Right Way so that this will just work?  How
will it be maintained when modules move around, get renamed, split into
sub-packages, et cetera?

These aren't in a state to be site packages; they're still undergoing
rapid architectural changes.  Thus, using monthy.pth isn't an option
(unless you can tell me otherwise).

Any guidance appreciated as I tread this unfamiliar ground.

 \        "I installed a skylight in my apartment. The people who live |
  `\                          above me are furious!"  -- Steven Wright |
_o__)                                                                  | 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B

More information about the Python-list mailing list