title: PyInstaller packed PySide6 application Cannot load qtquick2plugin.dll
body: <p>I have a PySide6 + QML application to pack to exe file with PyInstaller.</p>
  <p>Here's my code:</p>
  <p>main.qml</p>
  <pre><code>import QtQuick
  import QtQuick.Layouts
  import QtQuick.Controls
  
  ApplicationWindow {
      id: window
      title: &quot;Motor&quot;
      width: 500
      height: 600
      visible: true
  
      maximumHeight: height
      maximumWidth: width
  
      minimumHeight: height
      minimumWidth: width
  }
  </code></pre>
  <p>main.py</p>
  <pre><code>from PySide6.QtGui import QGuiApplication
  from PySide6.QtQml import QQmlApplicationEngine
  
  if __name__ == &quot;__main__&quot;:
      import sys 
      app = QGuiApplication(sys.argv)
      engine = QQmlApplicationEngine(parent=app)
    
      engine.load(&quot;main.qml&quot;)
      sys.exit(app.exec_())
      if not engine.rootObjects():
          sys.exit(-1)
      sys.exit(app.exec_())
  </code></pre>
  <p>motor.spec</p>
  <pre><code># -*- mode: python ; coding: utf-8 -*-
  
  block_cipher = None
  
  
  a = Analysis(['main.py'],
               pathex=['E:\\Projects\\motor\\GUI'],
               binaries=[],
               datas=[('main.qml', '.'), ('settings.ini', '.')],
               hiddenimports=['PySide6.QtCore', 'PySide6.QtGui', 'PySide6.QtQml'],
               hookspath=[],
               runtime_hooks=[],
               excludes=[],
               win_no_prefer_redirects=False,
               win_private_assemblies=False,
               cipher=block_cipher,
               noarchive=False)
  pyz = PYZ(a.pure, a.zipped_data,
               cipher=block_cipher)
  exe = EXE(pyz,
            a.scripts,
            [],
            exclude_binaries=True,
            name='MotorGUI',
            debug=False,
            bootloader_ignore_signals=False,
            strip=False,
            upx=True,
            console=True )
  coll = COLLECT(exe,
                 a.binaries,
                 a.zipfiles,
                 a.datas,
                 strip=False,
                 upx=True,
                 upx_exclude=[],
                 name='MotorGUI')
  </code></pre>
  <p>After pack with <code>pyinstaller motor.spec</code>, I copied <code>plugins</code>, <code>qml</code> and <code>translations</code> folder from python/site-pack/PySide6 folder to the exe's PySide6 folder.</p>
  <p>When I run the exe file, I got:</p>
  <pre><code>QQmlApplicationEngin failed to load component
  file:///E:/Projects/motor/GUI/dist/MotorGUI/main.qml:1:1: Cannot load library E:\Projects\motor\GUI\dist\MotorGUI\PySide6\qml\QtQuick\qtquick2plugin.dll
  </code></pre>
  <p>The <code>qtquick2plugin.dll</code> actually exists.</p>
  <p>my python version is 3.8.6</p>
  <p>PySide==6.0.0</p>
  <p>pyinstaller==4.2</p>