execute_python_file
Execute a Python file inside the running Unreal Editor to automate Blueprint, material, or asset tasks, returning Python output and engine logs to verify results.
Instructions
Execute a Python (.py) file inside the running Unreal Editor. PIE TRAP: same hole as execute_python -- arbitrary Python is NOT covered by the plugin's PIE guard, so a script that compiles a Blueprint or saves an asset runs even with Play-in-Editor live, where compiling can KILL the editor (UREINST_* retains a world, CheckForWorldGCLeaks is Fatal) and saving reports success without writing (Editor.AllowSavingAssetsDuringPIE=0). Check is_play_in_editor_active first when the file compiles, saves or mutates a Blueprint; reading the live world during PIE is safe. WARNING: log_output IS NOT THE LOG OF THE CALL -- it is Python's own prints only (UE fills it from a delegate broadcast solely by unreal.log/log_warning/log_error), so every UE_LOG the ENGINE emits during your script is absent from it. Read engine_log instead: it is the GLog slice bracketed to this call, Warning+Error by default. Example: build_meta_human can run, return None, write zero assets and report a clean log_output while "LogMetaHumanCoreTechLib: Error: Texture Synthesis has not been initialized" sits in GLog. When a call reports success and NOTHING HAPPENED, engine_log is the first place to look; widen with engine_log_level=Log, or pass log_cursor_before to get_output_log_lines(since_sequence_id=...) for the unfiltered rest.
Returns: { file_path, python_success, command_result, output, log_output, log_line_count, engine_log, engine_log_count, engine_log_truncated, log_cursor_before }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Absolute path to a .py file accessible from the editor host. | |
| engine_log_max | No | Max lines in `engine_log` (default 50, 0 disables, hard cap 4096). | |
| engine_log_level | No | Minimum severity of ENGINE log to return in `engine_log`: Error, Warning (default), Display, Log/All. |