package structure?

Torsten Mohr tmohr at s.netic.de
Sun Dec 14 15:16:34 EST 2008


Hi,

in a package i'd like to have a structure like this:

Files end with ".py", others are directories:

mod
  __init__.py       # sets __all__ = ['smod1']
  smod1.py          # contains AClass()
  smod1
    __init__.py     # sets __all__ = ['abc', 'def']
    abc.py
    def.py

So i can now do:

import mod.smod1.abc
import mod.smod1


But functions/classes in smod1.py are not found:

a = mod.smod1.AClass()

I know this is somehow ambiguous, but i wonder how else i can make
"mod" have subpackages and modules.

I wonder how i can make AClass() known in that package.


Thanks for any hints,
Torsten.




More information about the Python-list mailing list