How to connect PyQt signal to external function
<p>How does one connect a pyqt button signal in one file, to a function in another python file? I've tried various things, but nothing seems to work.
This is the first file:</p>

<pre><code>from PyQt4 import QtGui
from PyQt4.QtGui import QMainWindow
from MainUIFile import Ui_Main
from pythonfile import myOutsideFunction
class MainWindow(QMainWindow,Ui_file):
    def __init__(self):
        QMainWindow.__init__(self)
        self.setupUi(self)
        self.btn.clicked.connect(myOutsideFunction())
</code></pre>

<p>The second file that is called by the first:</p>

<pre><code>def myOutsideFunction(self):
    # Do some stuff here
</code></pre>

<p>How would I go about doing this?</p>

<p>You are currently making a call to <code>myOutsideFunction</code> and passing the result to the <code>connect</code> function, which expects a callable as an argument. </p>

<p>Remove the parenthesis from <code>myOutsideFunction</code> in the connect call</p>

<pre><code>self.btn.clicked.connect(myOutsideFunction)
</code></pre>

python windows file pyqt