Why is Pycharm debugger not stopping at a breakpoint outside the main thread?
<p>I'm using PyCharm 2016.2.3 (Build #PY-162.1967.10). I can't get the debugger to stop at any breakpoint out of the main thread no matter is the suspend property for the breakpoint is All or Thread; or if that is the only breakpoint in the whole program. The threading is implemented with a QObject moved into a QThread. This is a simple code to show the problem. A breakpoint anywhere in the secondary thread (inside Master.do() or Worker.run()) will not be hit.</p>

<pre><code>import sys
from PyQt5.QtCore import QCoreApplication, QObject, QThread, pyqtSignal, pyqtSlot


class Worker(QObject):
    """
    Generic worker.
    """
    start = pyqtSignal(str)
    finished = pyqtSignal()

    def __init__(self, function):
        QObject.__init__(self)
        self._function = function
        self.start.connect(self.run)

    @pyqtSlot()
    def run(self):
        #TODO Breakpoints inside this method will not be hit.
        self._function()
        self.finished.emit()


class Master(QObject):
    """
    An object that will use the worker class.
    """

    def __init__(self):
        QObject.__init__(self)

    def do(self):
        #TODO Breakpoints inside this method will not be hit.
        print("All done.")
        QCoreApplication.quit()


def main():
    app = QCoreApplication(sys.argv)

    master = Master()
    worker = Worker(master.do)

    thread = QThread()
    worker.moveToThread(thread)
    thread.started.connect(worker.run)

    # Terminating thread gracefully, or so.
    worker.finished.connect(thread.quit)
    worker.finished.connect(worker.deleteLater)
    thread.finished.connect(thread.deleteLater)

    thread.start()

    sys.exit(app.exec_())


if __name__ == "__main__":
    main()
</code></pre>