question about module resolution
Peter Otten
__peter__ at web.de
Wed Jan 17 11:20:17 EST 2007
Emin wrote:
> I often find myself wanting to have a child module get some parameters
> defined in a parent module. For example, imagine I have the following
> directory structure and want something in baz.py to look at a value in
> config.py. I end up putting in things like import sys;
> sys.path.append('../..'). Is there a better way?
>
> foo/
> __init__.py
> config.py
> bar/
> __init__.py
> baz.py
from __future__ import absolute_import
from .. import config
Peter
More information about the Python-list
mailing list