On Nov 16, [EMAIL PROTECTED] wrote:
> I have a package directory structure as follows
>
> root-
> |
> 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"
module.
> 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
possible.
> 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
...
mustard.attr
More import info from Fredrik:
http://effbot.org/zone/import-confusion.htm
--
_ _ ___
|V|icah |- lliott <>< [EMAIL PROTECTED]
" " """
--
http://mail.python.org/mailman/listinfo/python-list