def _runInMainThread(self, f):
        """
        Schedule function to run in main wx/Twisted thread.

        Called by the select() thread.
        """
        if hasattr(self, "wxapp"):
            wxCallAfter(f)
        else:
            # wx shutdown but twisted hasn't
            self._postQueue.put(f)

        Schedule function to run in main wx/Twisted thread.

        Called by the select() thread.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/wxreactor.py