title: Python (QtDesigner) Opening multiple .py files in MdiArea window with buttons
body: <p>I used QtDesigner to create all of my windows, the main window uses mdiArea so that other windows fit inside of it when called. My main problem is when I close a window inside the mdiArea it disappears and I can't reopen it, id either like the window to not have a exit button or make a window with buttons that will open the files if its not there.</p>
  
  <p>Output Screenshot</p>
  
  <p><img src="https://i.stack.imgur.com/Jiax5.png" alt=""></p>
  
  <p>The window that is minimized is ValveSimulator and if I close it it doesn't exist anymore and I can't open it</p>
  
  <p>my main code: CreateWindow makes the window with the buttons and CreateValveSimulator is my main program that I want to open from the button when I close it</p>
  
  <pre><code>from PyQt5 import QtCore, QtGui, QtWidgets, uic
  from PyQt5.QtWidgets import QApplication, QMainWindow, QTableWidget,QWidget, QMdiSubWindow
  import ValveSim
  import MainWindow
  import Window
  
  class Win1(QMainWindow):
      def __init__(self):
          QWidget.__init__(self)
          self.vtn = MainWindow.Ui_MainWindow()
          self.vtn.setupUi(self)
          self.subwindow = QMdiSubWindow()
          self.CreateValveSimulator()
          self.CreateWindow()
  
      def CreateValveSimulator(self):
          widget = QMainWindow()
          self.VSim_subwindow = ValveSim.Ui_ValveSim()
          self.VSim_subwindow.setupUi(widget)
          self.subwindow = QMdiSubWindow(self.vtn.mdiArea)
          widget.setParent(self.subwindow)
          self.subwindow.setWidget(widget)
          self.vtn.mdiArea.addSubWindow(self.subwindow)
          widget.show()
          self.subwindow.show()
          self.subwindow.widget().show()
  
      def CreateWindow(self):
          widget = QMainWindow()
          self.win_subwindow = Window.Ui_MainWindow()
          self.win_subwindow.setupUi(widget)
          self.subwindow = QMdiSubWindow(self.vtn.mdiArea)
          widget.setParent(self.subwindow)
          self.subwindow.setWidget(widget)
          self.vtn.mdiArea.addSubWindow(self.subwindow)
          widget.show()
          self.subwindow.show()
          self.subwindow.widget().show()
  
  if __name__=='__main__':
      app =QApplication(sys.argv)
      win = Win1()
      win.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>I connected the self.pushbutton to a function called openvs which I hope to open the Valve Simulator window when its closed as shown in my main code,however it just crashes when I click the button</p>
  
  <p>Table with buttons code:</p>
  
  <pre><code> from PyQt5 import QtCore, QtGui, QtWidgets, uic
  from PyQt5.QtWidgets import QApplication, QMainWindow, QTableWidget, QWidget, QMdiSubWindow, QAction
  import Untitled
  class Ui_MainWindow(object):
      def setupUi(self, MainWindow):
          MainWindow.setObjectName("MainWindow")
          MainWindow.setWindowModality(QtCore.Qt.WindowModal)
          MainWindow.resize(351, 442)
          MainWindow.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
          self.centralwidget = QtWidgets.QWidget(MainWindow)
          self.centralwidget.setObjectName("centralwidget")
          self.pushButton = QtWidgets.QPushButton(self.centralwidget)
          self.pushButton.setGeometry(QtCore.QRect(85, 125, 75, 23))
          self.pushButton.setObjectName("pushButton")
          self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
          self.pushButton_2.setGeometry(QtCore.QRect(85, 195, 75, 23))
          self.pushButton_2.setObjectName("pushButton_2")
          self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget)
          self.pushButton_3.setGeometry(QtCore.QRect(200, 125, 75, 23))
          self.pushButton_3.setObjectName("pushButton_3")
          MainWindow.setCentralWidget(self.centralwidget)
          self.pushButton.clicked.connect(self.openvs)
          self.retranslateUi(MainWindow)
          QtCore.QMetaObject.connectSlotsByName(MainWindow)
  
      def retranslateUi(self, MainWindow):
          _translate = QtCore.QCoreApplication.translate
          MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
          self.pushButton.setText(_translate("MainWindow", "Open Valve Simulator"))
          self.pushButton_2.setText(_translate("MainWindow", "Open Module Program"))
          self.pushButton_3.setText(_translate("MainWindow", "Open Metal Sizing"))
  
      def openvs(self):
          Untitled.Win1.CreateValveSimulator()
  </code></pre>