__init__.py

km srikrishnamohan at gmail.com
Tue Nov 14 08:07:50 EST 2006


Hi,
wow ! i tried it and it works like charm!
could access  variables  declared at root module dir  in submodules.
also i would like to know if i can have an abstract class declared in
__init__.py  with common variables ?

regards,
KM

On 11/14/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
>
> "km" wrote:
>
> > I have a structure like this :
> > foo/__init__.py
> > foo/bar/__init__.py
> > foo/bar/firstmodule.py
> > foo/abc/__init__.py
> > foo/abc/secondmodule.py
> >
> > now i have some variables (paths to data files) common, to be used in
> > first module and second modules respectively.
> > can i set those variables in foo/__init__.py so that i can access them
> by
> > foo.mypath1 in first and second submodule class definitions?
>
> looks ok to me, as long as you remember to actually import foo into your
> submodules.
>
> have you tried it?
>
> </F>
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061114/95291226/attachment.html>


More information about the Python-list mailing list