[Tutor] Classes in multiple files

Alan Gauld alan.gauld at btinternet.com
Thu Apr 4 01:32:43 CEST 2013


On 04/04/13 00:14, Phil wrote:

> If this was C++ then I'd need to include a class header and so I'm
> thinking that an import statement is needed in the main window class
> referring to the dialog class. Import SatelliteListDialog isn't correct.

Reme,ber that in python its the file name you need to use to import

So if SatelliteListDialog is defined in satellite.py you need

import satellite

in your main window file.
And satellite.py has to be in your library path too...

Then in your main window class you need to access the dialog with

    self.sld = satellite.SatelliteListDialog(...)

or whatever. In other words you need the module name prefix.

If that still doesn't work post some code and any error messages.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list