need clarification with import statements

Tool69 kibleur.christophe at gmail.com
Thu Dec 14 16:53:05 EST 2006


Hi,
I've got the following hierarchy:

mainprog/
    __init__.py
    prog.py
    utils/
        __init__.py
        myutils.py
    others/
        __init__.py
        myothers.py

Inside prog.py I need to have full access to myutils.py and
myothers.py;
Inside myutils.py, I need to access two classes from myothers.py (ie
myotherClass1 and myotherClass2);
Inside myothers.py, I need some functions of myutils.py (ie
myutils_func1 and myutils_func2);

Do you have some hints please ? I'm trying to avoid name conflicts, so
I haven't used "from ... import *".
I suspect ther's something wrong, but I think I really don't understand
what's going on internally (no errors (for the moment !))

Inside prog.py : from utils.myutils import myotherClass1, myotherClass2
+ some functions of myutils I need
Inside myutils.py : from other.myothers import myotherClass1,
myotherClass2
Inside others.py : import utils.myutils

Thanks.




More information about the Python-list mailing list