icon

[Frage] How to get PySide6 work in Allplan2026


Hello all,

We are at the beginning of the development of an interactor script that will be embedding complex GUIs.
For this reason we would like to design the graphical part of the script by using PySide6.

After having installed PySide6 in our Allplan2026 Python3.13 instance, we cannot manage to have have it working, it systematically ends up with an ImportError message :
ImportError: DLL load failed while importing Shiboken : The specified module was not found.

It seems the Python engine embedded in Allplan 2026 cannot load the Qt6 DLLs required by Shiboken6.

Then we tried to

- copy all the necessary DLLs in the path ...\Allplan\Allplan2026\Prg\bin\Qt and reference this in the script using
qt_path = r"...\Allplan\Allplan2026\Prg\bin\Qt"
os.add_dll_directory(qt_path) --> not working...

- copy all the necessary DLLs in the path ...\Allplan\Allplan2026\Prg\Python\DLLs --> not working...

- even copy all the necessary DLLs in the root path ...\Allplan\Allplan2026\Prg --> not working...

Did some of you succeed at running PySide6 inside Allplan PythonPartsScripts and in this case what is the procedure,
or is it simply impossible to have PySide6 running inside Allplan ?

Thanks for your help

Hilfreichste Antwort anzeigen Hilfreichste Antwort verbergen

Zitiert von: uid-401636
Hi,
That's not really our concern.
Actually, PySide6 and shiboken have been installed this way.

A GUI made with PySide6 is correctly launched inside the Allplan2026 Python environment (whose site-packages hase been appended with PySide6 and shiboken),

but as soon as launched inside Allplan2026 the "ImportError" occurs as the Qt6 DLLs required by Shiboken6 seem to be unloadable.
Best

Hello!

I can provide more information on the issue.

The main and presumably relevant thing for this issue, that is different between a clean (e.g. virtual) Python environment and Python environment running inside ALLPLAN are the paths. You can print them with:

import sys
for path in sys.path
    print(path)

Python normally looks for dll's in those paths. Apparently, Shiboken is trying to import a DLL, that is not in these paths or (more likely) a Shiboken's DLL rely on other DLL (which maybe rely on other one, and so on...), that is not in these paths. The problem here is, that we don't know, what DLL fails to be imported (cannot be found) because it's probably a non-python DLL. You can only find it out with a dependency walker. Once you've figured it out and know on which path this DLL is located, you can add the path to the sys.path (or os.add_dll_directory).

I hope, that helps somehow. If you try this approach, I'll be grateful for your feedback.

Cheers,
Bart

11 - 11 (11)

Hi,

the topic is old, but since I now have solution to use PySide6 within ALLPLAN.

And the solution is: Executing the Qt dialog in a separate Python subprocess.

Example: see attachement

The flow:

1. Subprocess Spawning (PySideExampleDialog.py:49-61)

subprocess.run(
    [self._python_exe(), __file__] + py_lib_path,
    input=input_data,
    capture_output=True,
    text=True,
)

__file__ makes the script run itself as a subprocess
py_lib_path (from sys.path) is passed as command-line args so the subprocess can import Allplan libraries
subprocess.run() blocks until the subprocess exits → inherently modal behavior

2. Inter-Process Communication
Parent → Subprocess (Input):

Current values (length, width, height) serialized to JSON
Passed via stdin to the subprocess
Subprocess → Parent (Output):

User-entered values serialized to JSON
Written to stdout before exit
Return code signals acceptance: 0 = OK, 1 = Cancel

3. Python Interpreter Detection (PySideExampleDialog.py:71-91)
Because sys.executable points to Allplan.exe (embedded Python), it searches for the actual python.exe in sys.prefix directories.

4. Subprocess Entry Point (PySideExampleDialog.py:186-195)
Only when run as subprocess does it import PySide6 and create the Qt application.

if __name__ == "__main__":
    _data = json.loads(sys.stdin.read())
    sys.path.extend(sys.argv[1:])  # Restore Allplan library paths
    from PySide6.QtWidgets import ...
    _run_dialog(_data["length"], _data["width"], _data["height"])

Hope that helps you leverage the capabilities of QT framework within ALLPLAN

Best regards,
Bart

Anhänge (1)

Typ: application/zip
4-mal heruntergeladen
Größe: 4,12 KiB
11 - 11 (11)