I am currently writing a ui script for Maya in python.
It goes something like this
def loadUI(): #loads UI def getMayaWindow(): #gets the maya main window class MainClass(): def __init__ (self, parent = getMayaWindow()): #initialise super(MainClass, self).__init__(parent) self.setupUi(self) #create connections to ui self.QComboBox.addItems([1,2,3,4]) self.deleteButton.clicked.connect(self.delete) def delete(self): self.deselect = self.QListWidget.selectedItems() for j in self.deselect: self.QListWidget.takeItem(self.QListWidget.row(j))
so, I have ui that has different tabs at the top and I do not want to put every single piece of code in the MainClass because that would be too messy and long. For every tab, I want to write its script in a different .py file. I want to create the connections under the init function, at the same time, load functions from another script into this MainClass to be used.
Question is, how should I go about calling objectName from the ui in a new file? I tried to import the MainClass code but that didn’t work and I don’t want the initialize the ui window in the new .py file. What’s a good way to go about this?