Importing from upper packages

H

Henning Kage

I have a library with the following structure:

library
/app
/db
/gui
/interface.py
/wx
/class.py

Each __init__.py file imports the next sub-package. E.g.:

library/__init__.py:
import app, db, gui

library/gui/__init__.py:
import wx
from interface import *

library/gui/wx/__init__.py:
from class import *

From the lowest layer "wx" I need to import an interface defined in the
gui package. Therefore I tried the following in library/gui/wx/class.py:

import library

class ClassTest( libor.gui.Interface):
pass

I also set the PYTHONPATH to top directory, but I still get an
ImportError. How could this problem be solved or otherwise, how should I
import from upper packages in general?

Thanks!
 
H

Henning Kage

Am Tue, 01 Mar 2005 21:45:17 +0100 schrieb Henning Kage:
import library

class ClassTest( libor.gui.Interface):
pass

Sorry, a small mistake:

class ClassTest( library.gui.Interface):
pass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top