Newbie packages Q

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Sun Oct 7 18:04:38 CEST 2007


MarkyMarc a écrit :
(snip)
> It was simply to make a point. But then lets say the to files looks
> like this:
> 
>  *******************************
> atest.py:
> 
> def printA():
>         print "This is Atest from Apack"
> *******************************
> btest.py:
> from Test.apack import atest


FWIW, better to stick to all_lower names for packages and modules.

> def printB():
>         print "This is Btest from Bpack"
> 
> def printatest():
>         print atest.printA()
> 
> print printB()
> print printatest()
> *******************************
> 
> Now only one of them imports the other, and this most be the simplest
> way of illustrating the intra-package references.
 >
> But how do I get this to work?

You failed to specify how your files are organized, and what is "not 
working".

But anyway, if
- atest.py is in <wherever>/Test/apack,
- both Test and apack have a __init__.py
- <wherever> is in the sys.path,

then this should just work AFAICT.




More information about the Python-list mailing list