title: python and pyqt5 - pass through variable once button is clicked
body: <p>I have 2 py files: my.py (this is my py created from ui - script where I have windows and input line, buttons) and vat.py (this is second script which needs to be started when pushButton_2 is clicked). I would like to run all lines from vat script but my.py needs to transfer some variables to vat.py. This is a issue - how I can do this?</p>
  
  <p>my.py</p>
  
  <pre><code>    # -*- coding: utf-8 -*-
  # Created by: PyQt5 UI code generator 5.13.2
  #
  # WARNING! All changes made in this file will be lost!
  
  #import vat
  
  import os
  import openpyxl
  
  from PyQt5 import QtCore, QtGui, QtWidgets
  from PyQt5.QtWidgets import QFileDialog, QMessageBox, QDialog, QInputDialog
  
  
  global glob
  glob = "empty"
  
  class Ui_MainWindow(QtWidgets.QWidget):
  
      def setupUi(self, MainWindow):
          MainWindow.setObjectName("MainWindow")
          MainWindow.setEnabled(True)
          MainWindow.resize(633, 392)
  
          icon = QtGui.QIcon()
          icon.addPixmap(QtGui.QPixmap("icon01.webp"), QtGui.QIcon.Selected, QtGui.QIcon.On)
          MainWindow.setWindowIcon(icon)
  
          self.centralwidget = QtWidgets.QWidget(MainWindow)
          self.centralwidget.setObjectName("centralwidget")
          self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
          self.lineEdit.setGeometry(QtCore.QRect(20, 40, 561, 20))
          self.lineEdit.setObjectName("lineEdit")
          self.pushButton = QtWidgets.QPushButton(self.centralwidget)
          self.pushButton.setGeometry(QtCore.QRect(590, 40, 25, 19))
          self.pushButton.setObjectName("pushButton")
  
          self.pushButton.clicked.connect(self.browsefiles)
  
          self.label = QtWidgets.QLabel(self.centralwidget)
          self.label.setGeometry(QtCore.QRect(20, 20, 141, 16))
          font = QtGui.QFont()
          font.setPointSize(10)
          self.label.setFont(font)
          self.label.setObjectName("label")
          self.mdiArea = QtWidgets.QMdiArea(self.centralwidget)
          self.mdiArea.setGeometry(QtCore.QRect(10, 10, 611, 81))
          self.mdiArea.setObjectName("mdiArea")
          self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
          self.pushButton_2.setGeometry(QtCore.QRect(20, 110, 75, 23))
          self.pushButton_2.setObjectName("pushButton_2")
  
          **self.pushButton_2.clicked.connect(self.start_app)**
  
          self.mdiArea.raise_()
          self.lineEdit.raise_()
          self.pushButton.raise_()
          self.label.raise_()
          self.pushButton_2.raise_()
          MainWindow.setCentralWidget(self.centralwidget)
          self.statusbar = QtWidgets.QStatusBar(MainWindow)
          self.statusbar.setObjectName("statusbar")
          MainWindow.setStatusBar(self.statusbar)
          self.menubar = QtWidgets.QMenuBar(MainWindow)
          self.menubar.setGeometry(QtCore.QRect(0, 0, 633, 21))
          self.menubar.setObjectName("menubar")
          self.menuKonwerter = QtWidgets.QMenu(self.menubar)
          self.menuKonwerter.setObjectName("menuKonwerter")
          MainWindow.setMenuBar(self.menubar)
          self.menubar.addAction(self.menuKonwerter.menuAction())
  
          self.retranslateUi(MainWindow)
          QtCore.QMetaObject.connectSlotsByName(MainWindow)
  
      def browsefiles(self):
          path = "~"
          full_path = os.path.expanduser(path)
          filename = QFileDialog.getOpenFileName(None, "Plik excel do zaimportowania", full_path, "Excel (*.xls *.xlsx)")
          filepath = filename[0]
          self.lineEdit.setText(filepath)
  
      def start_app(self):
          filepath = self.lineEdit.text()
          glob = filepath
  
          try:
              import vat
          except:
              infoBox = QMessageBox()  ##Message Box that doesn't run
              infoBox.setIcon(QMessageBox.Question)
              infoBox.setText("Błąd pliku!")
              infoBox.setInformativeText("Użyj rozszerzenia .xlsx.")
              infoBox.setWindowTitle("Załadowano błędny plik")
              #infoBox.setDetailedText("Detailed Text")
              #infoBox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
              infoBox.setEscapeButton(QMessageBox.Close)
              infoBox.exec()
  
      def retranslateUi(self, MainWindow):
          _translate = QtCore.QCoreApplication.translate
          MainWindow.setWindowTitle(_translate("MainWindow", "Spradzenie podatników VAT"))
          self.pushButton.setText(_translate("MainWindow", "..."))
          self.pushButton_2.setText(_translate("MainWindow", "Uruchom"))
          self.label.setText(_translate("MainWindow", "Plik wejściowy (excel):"))
          self.menuKonwerter.setTitle(_translate("MainWindow", "Konwerter"))
  
  
  if __name__ == "__main__":
      import sys
      app = QtWidgets.QApplication(sys.argv)
      MainWindow = QtWidgets.QMainWindow()
      ui = Ui_MainWindow()
      ui.setupUi(MainWindow)
      MainWindow.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>vat.py</p>
  
  <pre><code>from my import *
  print(glob)
  #imp = Ui_MainWindow.setupUi.__getattribute__(lineEdit.text()) - dosent work
  </code></pre>
  
  <p>All looks fine but when I run my.py and click button2 (where as you can see I am taking path from line edit) this is not working. I see in vat.py script that "glob = empty". Of course vat.py file has more functions and doing something but I need to make all steps from vat.py file (but I need to transfer some variable. Is it possible to also make a feedback from vat to my when vat finish all steps? 
  TIA  </p>