import sys from PySide6 import QtCore, QtGui, QtQml if __name__ == "__main__": app = QtGui.QGuiApplication(sys.argv) qml_engine = QtQml.QQmlApplicationEngine() qml_engine.load(QtCore.QUrl.fromLocalFile('tiny.qml')) if len(qml_engine.rootObjects()) != 1: QtCore.qFatal('Failed to load root objects into engine') main_window = qml_engine.rootObjects()[0] print(main_window.findChild(QtCore.QObject, 'test')) # This in combination with StateMachine causes crash main_window.show() sys.exit(app.exec())