PySide2 + QML: 'PySide2.QtWidgets.QFileDialog.getOpenFileName' called with wrong argument types

I am developing an app that uses QML and PySide2. I am trying to open a file dialog when a button is pushed, but I keep getting the following exception that I dont really understand:

FIXME Subscripted generics cannot be used with class and instance checks
Traceback (most recent call last):
  File "/home/chris/Documents/Programming/Synchrony/Desktop/", line 47, in sendFile
    file = QFileDialog.getOpenFileName(
TypeError: 'PySide2.QtWidgets.QFileDialog.getOpenFileName' called with wrong argument types:
  PySide2.QtWidgets.QFileDialog.getOpenFileName(MainWindow, str, str, str)
Supported signatures:
  PySide2.QtWidgets.QFileDialog.getOpenFileName(typing.Optional[PySide2.QtWidgets.QWidget] = None, str = '', str = '', str = '', PySide2.QtWidgets.QFileDialog.Options = Default(QFileDialog.Options))

Here is the code for my MainWindow:

class MainWindow(QObject):
    setPhones = Signal(list)

    def __init__(self, backend_socket):

        self.phone_connections = {}

        self.__command_handler_thread = CommandHandlerThread(backend_socket, self)

        self.log = lambda level, message, exception=False: \
            self.__command_handler_thread.log(level, message, exception)
        self.send_gui_command = lambda command:\

        self.log('d', "GUI started successfully!")

    def doSync(self, selected_phone):
        self.send_gui_command(f"do_sync: {selected_phone}")

    def sendClipboard(self, selected_phone):
        self.send_gui_command(f"send_clipboard: {selected_phone}")

    def sendFile(self, selected_phone):
        file = QFileDialog.getOpenFileName(
            self, "Open File", "", "")
        # self.send_gui_command(f"send_file: {selected_phone}")

    def update_phones_list(self, phone_names):

Additionally, in case it is relevant, here is my main() code where I declare the MainWindow:

def main():
    single_instance = singleton.SingleInstance()
    backend_socket = make_backend_connection()

    app = QGuiApplication()
    engine = QQmlApplicationEngine()

    main_window = MainWindow(backend_socket)
    engine.rootContext().setContextProperty("backend", main_window)

    engine.load(os.fspath(Path(__file__).resolve().parent / "GUI/MainWindow.qml"))

    if not engine.rootObjects():

Any ideas on what I can do to get a QFileDialog to work in my program?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum