Package / Module Hierarchy question

T

Torsten Mohr

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top