title: How do I hide current window while opening a new one using PyQt5
body: <p>I've linked another file to a pushButton in my main window. Every time I click it, the new window does open but the old (primary window) is still there. How do I close it or hide it without affecting the new window.</p>
  
  <p>PS: I'm a newcomer here. Apologies for any idiocies or mistakes while posting this query on my part. Thank you!</p>
  
  <p>Here's the relevant code:</p>
  
  <pre><code>    import sys  
      from PyQt5 import QtCore, QtGui, QtWidgets  
      from create2 import Ui_MainWindow  
      from PyQt5.QtWidgets import QMainWindow, QWidget  
      from PyQt5.QtCore import QMargins  
  
      class Ui_Form(object):  
          def setupUi(self, Form):  
              Form.setObjectName("Form")  
              Form.resize(813, 655)  
              self.widget = QtWidgets.QWidget(Form)  
              self.widget.setGeometry(QtCore.QRect(190, 50, 501, 591))  
              self.widget.setObjectName("widget")  
              .  
              .  
              .  
          def newusr_clk(self):  
              self.mainwin=QMainWindow()  
              self.ui=Ui_MainWindow()  
              self.ui.setupUi(self.mainwin)  
              self.mainwin.show() 
  </code></pre>