title: PyQt Update Child Widget Property
body: <p>I would like to update a TextBrowser widget in another window from the main window. The goal is to simply write strings to the widget to act as a pseudo console. When I inspect the QTextBrowser object, I can see that it supports <code>setText()</code> -- but I can not find a way to access <code>setText()</code> from the main window object (which I suspect is because I'm not calling it properly). Using a TextBrowser widget is not a requirement.</p>
  <p>The examples I've seen talk about using signals and slots for such operations but that seems to be overkill for what I'm trying to accomplish. Is it a requirement to use signals for something so simple, or can I somehow <code>setText()</code> (or something similar) from the main window?</p>
  <p><a href="https://i.stack.imgur.com/Wcdop.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wcdop.png" alt="Simple UI with Second Dialog" /></a></p>
  <h3>scratch.py</h3>
  <pre class="lang-py prettyprint-override"><code>#! /usr/bin/env python3
  # -*- coding: utf-8 -*-
  
  from PyQt5 import QtWidgets
  import sys
  
  from log_dialog import Ui_dialog
  
  class Application(QtWidgets.QMainWindow):
  
      def __init__(self, *args, **kwargs):
          super(Application, self).__init__(*args, **kwargs)
  
          self.show()
  
          # ===================================================
          self.log_widget = QtWidgets.QDialog()
          ui = Ui_dialog()
          ui.setupUi(self.log_widget)
          self.log_widget.exec_()
  
          # Write some text to log_widget  &lt;-----
  
          # ===================================================
  
  qApp = QtWidgets.QApplication(sys.argv)
  application_window = Application()
  sys.exit(qApp.exec_())
  </code></pre>
  <h3>log_dialog.py</h3>
  <pre class="lang-py prettyprint-override"><code>#! /usr/bin/env python3
  # -*- coding: utf-8 -*-
  
  # Form implementation generated from reading ui file 'log_dialog.ui'
  #
  # Created by: PyQt5 UI code generator 5.15.3
  #
  # WARNING: Any manual changes made to this file will be lost when pyuic5 is
  # run again.  Do not edit this file unless you know what you are doing.
  
  
  from PyQt5 import QtCore, QtGui, QtWidgets
  
  
  class Ui_dialog(object):
      def setupUi(self, dialog):
          dialog.setObjectName(&quot;dialog&quot;)
          dialog.resize(398, 307)
          sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
          sizePolicy.setHorizontalStretch(0)
          sizePolicy.setVerticalStretch(0)
          sizePolicy.setHeightForWidth(dialog.sizePolicy().hasHeightForWidth())
          dialog.setSizePolicy(sizePolicy)
          self.textBrowser = QtWidgets.QTextBrowser(dialog)
          self.textBrowser.setGeometry(QtCore.QRect(9, 9, 381, 291))
          self.textBrowser.setObjectName(&quot;textBrowser&quot;)
  
          self.retranslateUi(dialog)
          QtCore.QMetaObject.connectSlotsByName(dialog)
  
      def retranslateUi(self, dialog):
          _translate = QtCore.QCoreApplication.translate
          dialog.setWindowTitle(_translate(&quot;dialog&quot;, &quot;Log&quot;))
  
  
  if __name__ == &quot;__main__&quot;:
      import sys
      app = QtWidgets.QApplication(sys.argv)
      dialog = QtWidgets.QDialog()
      ui = Ui_dialog()
      ui.setupUi(dialog)
      dialog.show()
      sys.exit(app.exec_())
  </code></pre>