Overwrite variable from another class in another file in Python
Question: I'm trying to update my UI via a variable in another python file. Both are in
there own class. Both saved in a folder called: System. As I don't want to re-
execute UI, I can't simply import the file. My question: how does one change a
variable from another class in another file, without re-executing?

_toolsUI.py_

    
    
    class toolsUI:
        def __init__(self):
            # Store UI elements in a dictionary
            self.UIElements = {}
    
            if cmds.window("UI", exists=True):
                cmds.deleteUI("UI")
    
            self.UIElements["window"]=cmds.window("UI", width=200, height=600, title="UI")
            self.createColumn() # Create Column
    
            # Display window
            cmds.showWindow(self.UIElements ["window"])
    
        def createColumn(self):
            self.UIElements["column"] = cmds.columnLayout(adj=True, rs=3)
            self.UIElements["frameLayout"] = cmds.frameLayout(height=columnHeight, collapsable=False, borderVisible=True, label="To Change Label")
    

_maintenance.py_

    
    
    class maintenance:
        def __init__(self):
            changeLabel = "Label is Changed"
    
            self.changeLabelColumn(changeLabel) # Change Label Column
    
        def changeLabelColumn(self, changeLabel):
            import System.toolsUI as toolsUI """<--- probably not a good idea"""
            cmds.frameLayout(toolsUI.UIElements["frameLayout"], edit=True, label=changeLabel)
    


Answer: The right way to do this afaict would be to create an _object_ of the
`toolsUI` type, and then operate on that instead.

    
    
    import System
    
    class maintenance:
        def __init__(self):
            changeLabel = "Label is Changed"
            self.ui = System.toolsUI() # create a new object
            self.changeLabelColumn(changeLabel)
    
        def changeLabelColumn(self, changeLabel):
            cmds.frameLayout(
                self.ui.UIElements["frameLayout"],  # use the object instead
                edit=True, 
                label=changeLabel)
    

this way you can have multiple `toolsUI` objects that don't interfere with
each other.

