I want to run another python file when I press the button in the desktop program. However, when I press the button, I get the "QWidget: Must construct a QApplication before a QWidget" error.
Other python file is selenium library that works with webdriver. Data is collected in user.py.
masaustu.py
import sys , os
from PyQt5 import QtWidgets , QtGui
from PyQt5.QtWidgets import QMainWindow , QApplication , QWidget ,
QPushButton , QAction , QLineEdit , QMessageBox
from subprocess import Popen
class App(QMainWindow):
def on_click(self):
usernameValue = self.username.text()
passwordValue = self.password.text()
nicknameValue = self.nickname.text()
timeValue = self.time.text()
QMessageBox.question(self, 'Message - pythonspot.com', "guduu: " + nicknameValue, QMessageBox.Ok, QMessageBox.Ok)
Popen('python another.py')
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = App()
sys.exit(app.exec_())
user.py
import importlib
from masaustu import App
App()
username = App.usernameValue
password = App.passwordValue
nickname = App.nicknameValue
time = App.timeValue
another.py works perfectly. But I could not connect with the desktop application. How can I do it ?