creating package question
mde at micah.elliott.name
Wed Nov 16 21:29:12 CET 2005
On Nov 16, erick_bodine at comcast.net wrote:
> I have a package directory structure as follows
> Common (contains __init__.py file)
> WindowsComponents (contains __init__.py file)
> I would like modules in the WindowsComponents directory to be able
> to import some modules from the Common directory.
So you now have a "Common" package. And it might contain a "mustard"
> In my first pass, I was able to append sys.path (
> sys.path.append('../Common') ) in each module that wants to import
> from Common, but this feels "clunky".
Agreed. You probably want to avoid messing with sys.path whenever
> Is there a "standard"/"best" way to accomplish this?
So "root" should already be on your sys.path/PYTHONPATH.
Then in say file "root/WindowsComponents/spam.py":
from Common import mustard
More import info from Fredrik:
_ _ ___
|V|icah |- lliott <>< mde at micah.elliott.name
" " """
More information about the Python-list