import structures

spohle spohle at gmail.com
Mon Apr 30 11:02:58 EDT 2007


On Apr 30, 8:00 am, Paul McGuire <p... at austin.rr.com> wrote:
> On Apr 30, 9:56 am, spohle <spo... at gmail.com> wrote:
>
>
>
> > hi,
>
> > i have written a small project for myself all in seperate classes and
> > each of the classes lives in a seperate file. now i am looking for an
> > import structure something like import wx, and then have access to all
> > my classes just like wx.Button or wx.BoxSizer etc.
>
> > as of now i have a __init__.py file in the directory with:
> > from pkgutil import extend_path
> > __path__ = extend_path(__path__, __name__)
>
> > but i still have to import each class by it's own. im really looking
> > for something like import wx
> > and then get all my access right away under this new namespace.
>
> > thank you in advance
>
> If it really is a small project, consider just putting all the classes
> into a single module, say spohlePkg.py.  Then your users would import
> this module using "import spohlePkg", and would access the classes as
> "spohlePkg.ClassA", "spohlePkg.ClassB", etc.
>
> -- Paul

yeah i had that, but my classes grew really fast and i decided to
split them up. but you're right that in one file that would solve my
problem. still hoping to find a way for the seperate files.




More information about the Python-list mailing list