Path question

Geert Vancompernolle geert.discussions at gmail.com
Tue Feb 3 13:47:29 EST 2009


Hi,

I have the following path construction:

./src/__init__.py
     /main.py
     /modules/__init__.py
             /application.py
     /ui/__init__.py
        /mainwindow/__init__.py
                   /mainwindow.py

Now I want to call the method 'MainWindow' in the module 'mainwindow', 
from the module 'application'.

I'm having the following import statement in 'applications.py':

from .. ui.mainwindow.mainwindow import MainWindow

That doesn't work.  I've also tried many other combinations like from 
..ui.mainwindow...  but none of them work.

I always get the following error:

"Attempted relative import beyond toplevel package"

How can I import the method 'MainWindow' from 'mainwindow' into 
'application', using the explicit relative import rules?

Or is there a better way to do this?
  
-- 
Best rgds,

Geert
________________________________________________

*Use EcoCho <http://www.ecocho.com>: environmentally friendly search the 
internet!*



More information about the Python-list mailing list