You might try this in qwe.py<br><br>import os,sys<br>sys.path.append(os.getcwd()+"../")<br><br>This will allow you to then import modules from module(dir).<br>Hope this helps. OTOH, there maybe a better solution.<br>
<br clear="all">-Alex Goretoy<br><a href="http://www.alexgoretoy.com">http://www.alexgoretoy.com</a><br><br>
<br><br><div class="gmail_quote">On Sun, Jan 4, 2009 at 9:10 PM, Torsten Mohr <span dir="ltr"><<a href="mailto:tmohr@s.netic.de">tmohr@s.netic.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
in a package i use these files:<br>
<br>
module (dir)<br>
  __init__.py<br>
  submodule<br>
    __init__.py<br>
    qwe.py<br>
<br>
<br>
qwe.py defines a class that derives from a class defined in submodule (and by that in submodule/__init__.py.<br>
<br>
Is it possible somehow to write in qwe.py to import submodule (though __init__.py is in the same directory as qwe.py ?<br>
<br>
I'd like to keep the tests for qwe.py within qwe.py, the code that i want to<br>
execute when i directly execute qwe.py and then:<br>
<br>
if __name__ == '__main__':<br>
    some_test_code()<br>
<br>
<br>
Or do i need to write an external test code?<br>
<br>
<br>
Thanks for any hints,<br>
Torsten.<br>
<font color="#888888"><br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>