python packages cross references

Roman Yakovenko roman.yakovenko at actimize.com
Tue Aug 17 04:08:44 EDT 2004


Peter Maas wrote:
> Roman Yakovenko schrieb:
> > Hi. I need help( or solution :-) ). 
> > Problem: my project has 3 packages
> > prj
> >  +------A
> >  +------B
> >  +------Utils
> > 
> > The question is: what is the right way to use functionality from
>  > Utils in A and B packages ?
> 
> Look at Python Tutorial Packages (6.4). You can make a prj package
> and use intra-package references (6.4.2) for A, B and Utils.
> 
> Mit freundlichen Gruessen,
> 
> Peter Maas

May be I was not clear, but from module in package A I want to user functionality
defined in module of package Utils

"...
When packages are structured into subpackage (as with the Sound package in the example), there's no shortcut to refer to submodules of sibling packages - the full name of the subpackage must be used. For example, if the module Sound.Filters.vocoder needs to use the echo module in the Sound.Effects package, it can use from Sound.Effects import echo. 
...
"
It means that I should have prj in sys.path. ( Am I wrong here? ).

So I ask is there is elegant solution?

Thanks



More information about the Python-list mailing list