Package / Module Hierarchy question

Torsten Mohr tmohr at s.netic.de
Sun Jan 4 16:10:42 EST 2009


Hi,

in a package i use these files:

module (dir)
  __init__.py
  submodule
    __init__.py
    qwe.py


qwe.py defines a class that derives from a class defined in submodule (and by that in submodule/__init__.py.

Is it possible somehow to write in qwe.py to import submodule (though __init__.py is in the same directory as qwe.py ?

I'd like to keep the tests for qwe.py within qwe.py, the code that i want to
execute when i directly execute qwe.py and then:

if __name__ == '__main__':
    some_test_code()


Or do i need to write an external test code?


Thanks for any hints,
Torsten.




More information about the Python-list mailing list