Ok, thanks for providing the pastebins. It is now completely clear why you are having the issue you reported.
In your uiCode module, you have that create_window() function. It creates a ListWindow instance, sets it up, and returns it. Then in your mainCode, you call create_window() which returns an instance of ListWindow. But then you try and set up a slot function that wants to refer to "listWidget". This is clearly not defined anywhere in the global space of uiCode. Even if it was defined in uiCode, you are referring to it without the "uiCode" namespace, which means you expect it to have been imported into the root of your mainCode. More specifically... in the body of the create_window() function, you create a number of *local* variables. One of those local variables is "listWidget". I assume this is the variable you are trying to access. The problem is that you cannot access any local variables like that, from another module. They simply don't exist beyond the function. What you are trying to accomplish here should be done by making an accessor or just an attribute on your ListWindow class which stores the QListWidget in a way that it is easy to access. Your design of using a bunch of functions is probably working against you here. Since you already have a custom ListWindow class, can you not just set all this up in the constructor? ( http://paste.ubuntu.com/13882063/ ) ## uiCode.py class ListWindow(QtGui.QMainWindow): refreshClicked = Signal(list) def __init__(self, controller, parent = None): super(ListWindow, self).__init__(parent) self.setWindowTitle('Padraigs List') # .. container = QtGui.QWidget(self) # ... self.listWidget = QtGui.QListWidget(container) # ... ## mainCode.py#... def refresh(): _window.listWidget.clear() Or better yet, hide away the implementation details of the composed widgets, and expose just the API you want to be public... ## uiCode.pyclass ListWindow(QtGui.QMainWindow): refreshClicked = Signal(list) def __init__(self, controller, parent = None): super(ListWindow, self).__init__(parent) self.setWindowTitle('Padraigs List') # .. container = QtGui.QWidget(self) # ... self.__listWidget = QtGui.QListWidget(container) # ... def clearList(self): self.__listWidget.clear() ## mainCode.py#... def refresh(): _window.clearList() Also, I am not sure if this is causing a bug for you, or just something you did accidentally while simplifying the example, but you are emitting a python "list" type here and not any kind of value: def refresh(): window.refreshClicked.emit(list) button.clicked.connect(refresh) Justin On Thu, Dec 10, 2015 at 1:24 PM Padraig Ó Cuínn < [email protected]> wrote: > Ok so here are the links for you > > Here is the uiCode.py > http://pastebin.com/EpGGzqGd > <http://www.google.com/url?q=http%3A%2F%2Fpastebin.com%2FEpGGzqGd&sa=D&sntz=1&usg=AFQjCNEYdPXU4ekhl9YrIlzjcvdRP7DdSQ> > > > Here is the mainCode.py(maya) > http://pastebin.com/8a5chQDF > > some of the previous code wasn't right such as _window being window > > the statusbar is working perfectly in it so you wont need to worry about > that unless you have something impressive to show me :) > > Thanksies > > Padraig > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/5fb6eb90-d201-46ed-87fb-dcaed8c4e8f0%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/5fb6eb90-d201-46ed-87fb-dcaed8c4e8f0%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3XB%3DVrQJoGCY4raOg9R6vB%3D%2BOFgR8xedQ%2BDsL4G1XktQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
