Text from LineEdit1 (Form1) to LineEdit2 (Form2)_ Python, PyQt
<p>I have created MainWindow with LineEdit11 and button1 in main window. Also I created V1 Form 2 with LineEdit and a button 2.</p>

<p>When I cliked a Button1  Form 2 will show. I write a text in lineEdit and i want to transfer text to LineEdit11 in form1 by cliked Button2. How to connect them? </p>

<p>Python 3.5, PyQT 4</p>

<p>Thank you in advance</p>

<p>OK so I write in V1 class </p>

<pre><code>def wyslij(self):
        self.lineEdit.setText(self.Ui_Form.lineEdit_11.text())
</code></pre>

<p>And i get error:</p>

<blockquote>
  <p>'Ui_V1' object has no attribute 'Ui_Form'
  Of course i add V1 class into Ui_Form. V1 is second window and Ui_Form is main window.</p>
</blockquote>

<p>This is a whole code:</p>

<pre><code>from PyQt4 import QtCore, QtGui
from V1 import Ui_V1
from V2 import Ui_V2
from V3 import Ui_V3

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

# V1 window
class Ui_V1(object):
    def setupUi(self, V1):
        V1.setObjectName(_fromUtf8("V1"))
        V1.resize(400, 300)
        self.label = QtGui.QLabel(V1)
        ...
        self.pushButton.setText(_translate("V1", "Wyslij", None))
        self.pushButton_2.setText(_translate("V1", "Wyslij", None))
        self.pushButton.clicked.connect(lambda: self.wyslij())

    def wyslij(self):
        self.lineEdit.setText(self.Ui_Form.lineEdit_11.text())



# V2 okno
class Ui_V2(object):
    def setupUi(self, V2):
        V2.setObjectName(_fromUtf8("V2"))
        V2.resize(400, 300)
        self.label_4 = QtGui.QLabel(V2)
        ...
        self.pushButton.setText(_translate("V2", "Wyslij", None))
        self.label.setText(_translate("V2", "V2", None))
        self.label_3.setText(_translate("V2", "A", None))
        self.pushButton_2.setText(_translate("V2", "Wyslij", None))

# V3 okno
class Ui_V3(object):
    def setupUi(self, V3):
        V3.setObjectName(_fromUtf8("V3"))
        V3.resize(400, 300)
        self.label_4 = QtGui.QLabel(V3)
       ...
        self.pushButton.setText(_translate("V3", "Wyslij", None))
        self.label.setText(_translate("V3", "V3", None))
        self.label_3.setText(_translate("V3", "A", None))
        self.pushButton_2.setText(_translate("V3", "Wyslij", None))



# Main window!
class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(728, 601)
        Form.setMinimumSize(QtCore.QSize(728, 601))
        self.label_6 = QtGui.QLabel(Form)
        self.label_6.setGeometry(QtCore.QRect(169, 3, 401, 41))
        self.label_6.setObjectName(_fromUtf8("label_6"))...


    def retranslateUi(self, Form):
        Form.setWindowTitle(_translate("Form", "Form", None))
        self.label_6.setText(_translate("Form", "&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=\" font-size:16pt; font-weight:600;\"&gt;TYGODNIOWA KONTROLA JAKOSCI&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;", None))
        self.label_8.setText(_translate("Form", "(dd-mm-rrrr)", None))...

        self.pushButton_2.clicked.connect(lambda: self.zapis_tyg()) # Do zapisu do tyg formularza
        self.pushButton_5.clicked.connect(lambda: self.openV1())  # Do pojawienia si eokna V1
        self.pushButton_6.clicked.connect(lambda: self.openV2())  # Do pojawienia si eokna V2
        self.pushButton_7.clicked.connect(lambda: self.openV3())  # Do pojawienia si eokna V3

    #zapis do pliku formularza tyg
    def zapis_tyg(self): # ZAPIS DO FORMULARZ TYGODNIOWEGO
         s = ""
         seq = (self.comboBox_6.currentText(), ".txt"); # This is sequence of strings. laczenie aby nazywaÅ pliki wzaleznosci od aparatu
         a= s.join( seq )
         text_file = open( a , "a")
         text_file.write(self.lineEdit.text()+ "\t" ) #data
         text_file.write(self.lineEdit_2.text()+ "\t" ) #osoba
         text_file.write(self.comboBox_6.currentText() + "\t" ) #aparat
         text_file.write(self.comboBox.currentText() + "\t" ) #AKCESORIUM
         text_file.write(self.comboBox_2.currentText() + "\t" ) #ZAB ANTYK
         text_file.write(self.comboBox_3.currentText() + "\t" ) #iZO
         text_file.write(self.comboBox_4.currentText() + "\t" )# CENTRQTOR
         text_file.write(self.comboBox_5.currentText() + "\t" )# TELEMETR
         text_file.write(self.textEdit.toPlainText()+ "\n" ) # KOM MECH
         text_file.close()

    #function to show a new form
    def openV1(self):
        self.V1Window=QtGui.QMainWindow()
        self.ui= Ui_V1()
        self.ui.setupUi(self.V1Window)
        self.V1Window.show()

    def openV2(self):
        self.V2Window=QtGui.QMainWindow()
        self.ui= Ui_V2()
        self.ui.setupUi(self.V2Window)
        self.V2Window.show()

    def openV3(self):
        self.V3Window=QtGui.QMainWindow()
        self.ui= Ui_V3()
        self.ui.setupUi(self.V3Window)
        self.V3Window.show()
</code></pre>

<p>And this Line:</p>

<pre><code>def wyslij(self):
        self.lineEdit.setText(self.Ui_Form.lineEdit_11.text())
</code></pre>

<p>Not work properly .</p>

<p>Without any code the simplest way (but not the best) would be something like that :</p>

<pre><code>def on_button2_click(self):
    self.form2.lineEdit2.setText(self.lineEdit1.text())
</code></pre>

python pyqt4