Scripting
The plugin’s editor subsystem, PhEditorSubsystem, has three functions for scripted imports. Call them from editor Python, from an Editor Utility Blueprint, or from any tool that already drives the editor, such as an editor MCP server that runs Python for an AI agent. The console commands Ph.Import and Ph.AgentStatus call the same functions.
Script imports do not need Accept agent imports. That setting only gates imports an agent queues through the Prophouse MCP (see agent imports). A script import needs a signed-in editor. It also needs the Prophouse desktop app installed, unless Use legacy direct transfers (deprecated) is on.
Get the subsystem
Section titled “Get the subsystem”Python calls need Unreal’s Python Editor Script Plugin enabled in your project.
import unreal
ph = unreal.get_editor_subsystem(unreal.PhEditorSubsystem)In Blueprints, the nodes are under Prophouse > Agent.
Functions
Section titled “Functions”| Python | Blueprint | Returns | Description |
|---|---|---|---|
get_agent_bridge_status() |
Get Agent Bridge Status | PhAgentBridgeStatus |
Whether this editor is ready to import and, if not, what to fix. |
import_entries(entry_ids, target_root) |
Import Entries | PhAgentImportResult |
Starts an import of the given catalog entry ids and their dependencies into this project. Returns at once. |
get_last_agent_import() |
Get Last Agent Import | PhAgentImportResult |
The latest script or agent import in this editor session. Poll it for progress and results. |
import_entries takes a list of entry ids (integers) and a destination root such as "/Game/Kit". Pass an empty string to use the Default Destination Root setting (/Game/Prophouse when that is blank). The function drops duplicate ids and ids below 1.
The import runs through the normal pull pipeline in this editor. If a file in the project has a local edit, the import keeps the local file and opens no dialog. Only one Prophouse import runs at a time.
import_entries returns with state set to creating. If the import cannot start, state is rejected and error_code says why:
error_code |
Cause |
|---|---|
NOT_SIGNED_IN |
The editor is not signed in to Prophouse. |
VALIDATION |
The list had no entry id of 1 or more. |
BUSY |
Another Prophouse import or pull is running in this editor. job_id holds the running script or agent import’s id, or 0 for any other pull. Wait for it to finish and call again. |
DESKTOP_AGENT_UNAVAILABLE |
The desktop app is not installed, failed to start in the last 2 minutes, or is running a version the plugin cannot use. In the last case the message says to update the desktop app and the plugin to the latest release. |
SHUTTING_DOWN |
The editor is closing. |
If the server refuses to create the job, the import moves to failed. error_code is then the server’s error code, or SERVER_UNREACHABLE when the editor could not reach the server.
PhAgentImportResult
Section titled “PhAgentImportResult”| Field (Python) | Type | Meaning |
|---|---|---|
job_id |
int | The import job’s id. 0 until the server creates the job. |
state |
str | none, rejected, creating, waiting, importing, done, failed or cancelled. |
source |
str | script for import_entries. mcp for imports an agent queued through the Prophouse MCP. |
message |
str | A status line, such as Imported job #42: 3 placed, 5 already current, 0 kept local. |
error_code |
str | The error code when state is rejected, waiting or failed. |
object_paths |
list of str | Object paths now in the project, placed by this import or already present and identical. Example: /Game/Prophouse/Meshes/SM_Crate.SM_Crate. Includes dependencies such as materials and textures. |
kept_local |
list of str | Object paths where the import kept your local edit and did not place the incoming version. |
failed_items |
list of str | <package>: <error> for each asset that failed to place. |
waiting means the editor could not start an mcp import and will retry it after 2 minutes. The usual cause is that the desktop app failed to start. When a script import can’t start, its state is failed instead, because the editor does not retry it. The job stays in the Prophouse panel under Pending imports, where you can click Import once the desktop app is running, or you can call import_entries again.
PhAgentBridgeStatus
Section titled “PhAgentBridgeStatus”| Field (Python) | Type | Meaning |
|---|---|---|
signed_in |
bool | A server URL and token are configured. |
server_url |
str | The Server URL setting. |
project_key |
str | The key imports must target to land in this editor. |
default_root |
str | The Default Destination Root setting, or /Game/Prophouse when it is blank. |
accept_agent_imports |
bool | The Accept agent imports setting. |
desktop_agent |
str | live (running), launchable (installed, the editor starts it when needed), unavailable, not_required (legacy direct transfers are on) or unknown. |
connection |
str | unknown, connected, auth_failed or unreachable. |
presence_healthy |
bool | The editor’s last check-in reached the server and the server accepted it. |
last_heartbeat_error |
str | Why the last check-in failed, if it did. |
seconds_since_heartbeat |
int | Seconds since the last accepted check-in, or -1 if there has been none. |
busy_job_id |
int | The agent or script import running now, or 0. |
pending_agent_jobs |
int | Agent imports the server has queued for this editor that have not started. |
problems |
list of str | Problem codes, empty when ready: NOT_SIGNED_IN, AUTH_FAILED, SERVER_UNREACHABLE, SERVER_TOO_OLD, AGENT_IMPORTS_DISABLED, DESKTOP_AGENT_UNAVAILABLE. |
summary |
str | Ready, or Not ready: followed by what to fix. |
AGENT_IMPORTS_DISABLED only blocks imports queued through the MCP. import_entries works with that problem listed.
Check readiness
Section titled “Check readiness”status = ph.get_agent_bridge_status()print(status.summary)for code in status.problems: print("problem:", code)Example: import, then spawn
Section titled “Example: import, then spawn”Imports run on the editor’s main thread. A loop that waits with time.sleep() blocks the editor, and the import never advances. Poll from a tick callback instead. This example imports two entries. When the import is done, it spawns every mesh and Blueprint it placed into the current level.
import unreal
ENTRY_IDS = [1234, 5678] # catalog entry idsTARGET_ROOT = "" # "" = the Default Destination Root setting
ph = unreal.get_editor_subsystem(unreal.PhEditorSubsystem)actors = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)
result = ph.import_entries(ENTRY_IDS, TARGET_ROOT)if result.state == "rejected": raise RuntimeError(f"{result.error_code}: {result.message}")
SPAWNABLE = (unreal.StaticMesh, unreal.SkeletalMesh, unreal.Blueprint)
def spawn(paths): x = 0.0 for path in paths: asset = unreal.load_asset(path) if not isinstance(asset, SPAWNABLE): continue # skip materials, textures and other dependencies actors.spawn_actor_from_object(asset, unreal.Vector(x, 0.0, 0.0)) x += 300.0
def on_tick(delta_seconds): last = ph.get_last_agent_import() if last.state in ("creating", "importing"): return unreal.unregister_slate_post_tick_callback(handle) if last.state == "done": spawn(last.object_paths) unreal.log(last.message) else: # failed, cancelled, or waiting (a script import is not retried) unreal.log_warning(f"{last.state}: {last.error_code} {last.message}")
handle = unreal.register_slate_post_tick_callback(on_tick)object_paths lists every asset the import brought in, dependencies included. That is why the example filters by class before it spawns.
Console commands
Section titled “Console commands”Type these into the editor’s console. Output goes to the Output Log under LogProphouse.
| Command | What it does |
|---|---|
Ph.Import <entryId> [<entryId>...] [Root=/Game/Path] |
Calls import_entries with the given ids and optional destination root, then prints the starting state and message. |
Ph.AgentStatus |
Prints the readiness summary and status fields. If there has been an import this session, it also prints that import’s job id, source, state, message and object paths. |
Ph.Import 1234 5678 Root=/Game/KitPh.AgentStatus