Ayon popup not opening in unreal engine

Ayon Unreal Plugin: Button Doesn’t Work Due to Missing ayon_core Module (PYTHONPATH Not Added to sys.path)

Environment:

  • Unreal Engine 5.6
  • Ayon Launcher 1.4.1
  • Ayon Core 1.7.2
  • Ayon Unreal 0.2.15
  • Ayon Unreal Plugin: From Github (lastest Version), Automatically installed and builded by myself
  • Windows

When launching Unreal Engine via the Ayon desktop launcher and clicking the Ayon button in the toolbar, I see the following log message:

LogPython: Warning: Ayon: showing tools popup

But no popup or dialog appears. Investigating further, the root cause is that the Ayon integration fails to load during startup, with this error:

LogPython: Error: Ayon: cannot load Ayon integration [ No module named 'ayon_core' ]

Investigation:
The Ayon launcher correctly sets the PYTHONPATH environment variable, which includes the necessary paths for Ayon modules. For example, when checked in Unreal’s Python console:

PYTHONPATH: C:\Program Files (x86)\Ayon\AYON 1.4.1\common;C:\Program Files (x86)\Ayon\AYON 1.4.1\dependencies;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\core_1.7.2\ayon_core\vendor\python;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\applications_1.3.1;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\ayon_third_party_1.4.0;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\blender_1.0.10-dev1;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\core_1.7.2;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\houdini_0.9.1-dev1;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\maya_0.4.18;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\nuke_0.3.13-dev1;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\photoshop_0.3.2;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\royalrender_0.3.1-dev1;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\traypublisher_0.3.8;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\unreal_0.2.15;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\usd_0.1.4;C:\Users\jbloenni\AppData\Local\Ynput\AYON\addons\version_control_0.1.0;C:\Users\jbloenni\AppData\Local\Ynput\AYON\dependency_packages\ayon_2510091624_windows.zip\dependencies

However, Unreal Engine’s embedded Python does not automatically add PYTHONPATH to sys.path (unlike a standard Python interpreter). As a result, sys.path only contains Unreal’s default paths, and the Ayon imports fail.

I fixed this by modifying the plugin’s init_unreal.py file to manually parse PYTHONPATH and add the paths to sys.path before attempting the imports. Here’s the updated code at the top of the file:

# Copyright (c) 2025 Ynput s.r.o.
import unreal
import sys
import os

# Add PYTHONPATH to sys.path since Unreal doesn't do it automatically
pythonpath = os.environ.get('PYTHONPATH', '')
if pythonpath:
    for path in pythonpath.split(';'):
        if path and path not in sys.path:
            sys.path.insert(0, path)

ayon_detected = True
try:
    from ayon_core.pipeline import install_host
    from ayon_unreal.api import UnrealHost
    ayon_host = UnrealHost()
# ... rest of the code

After this change, the Ayon integration loads successfully, and the button works as expected.

Question:
Is there a configuration or setting I’m missing that would make Unreal automatically include PYTHONPATH in sys.path? It seems like the plugin should handle this automatically, especially since the Ayon launcher sets PYTHONPATH correctly.

AYON is taking care actually by itself here:

Unreal is indeed ignoring PYTHONPATH but it is using UE_PYTHONPATH instead. I am glad that your change is working for you but there must be something wrong somewhere else.

I haven’t seen such reports yet. There is this issue that might be related however:

The PYTHONPATH should be indeed taken from env["PYTHONPATH"] as is mentioned in that issue then directly from os.environ because if you set PYTHONPATH somewhere in AYON it could be overwritten by system one or be empty and that would result in your problem.

Thanks for pointing out UE_PYTHONPATH.
It looks like the issue is that the path is being overwritten. In our case, the environment variable is only set to Royal Render:
RR\render_apps\_submitplugins\UnrealEngine_5\Python

As a result, the other required paths are missing. This may be happening automatically as part of Royal Render’s setup.
We’ll proceed with our workaround on this side.

Thanks for the clarification!
Justus

Okay… Another workaround is just setting it in the application settings another time:

{
    "UE_PYTHONPATH": [
        "{PYTHONPATH}",
        "{UE_PYTHONPATH}"
    ]
}
1 Like

These two seem quite equivalent. Both are adding PYTHONPATH to UE_PYTHONPATH.
I wonder if they are evaluated at a different point of time on launching the app.