You might try this in qwe.py

import os,sys
sys.path.append(os.getcwd()+"../")

This will allow you to then import modules from module(dir).
Hope this helps. OTOH, there maybe a better solution.

-Alex Goretoy
http://www.alexgoretoy.com



On Sun, Jan 4, 2009 at 9:10 PM, Torsten Mohr <tm...@s.netic.de> wrote:

> 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.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to