Use Blueprints from Python¶
How do I call a Blueprint or C++ function, or load a Blueprint class?
Engine and C++ classes¶
Every reflected class is an attribute of ue, with snake_case names for functions and properties.
ue.GameplayStatics.get_player_pawn(0)
ue.KismetMathLibrary.make_transform(location, rotation, scale)
actor.set_actor_location(location, False, True)
Project assets¶
Each content folder is a module. Blueprints, interfaces, user structs and enums are typed classes; other assets are typed instances.
from ue.assets.Game.Weapons import BP_Rifle
rifle = ue.spawn_actor(BP_Rifle, ue.Vector(0, 0, 100))
rifle.fire() # a Blueprint function, typed in the stub
The same imports load the real classes at runtime. In the editor the stubs follow compiles, saves, renames and deletions.
By path¶
mesh = ue.load_object("/Engine/BasicShapes/Cube.Cube")
cls = ue.load_object("/Game/Weapons/BP_Rifle.BP_Rifle_C")
ue.invoke_by_name(obj, "FunctionName", *args) calls a function by its Unreal name.
Events and delegates¶
Bind to an exposed dispatcher with .add(callback):
door.on_opened.add(lambda by: ue.log("opened"))
Property access follows Unreal's exposure rules: non-reflected C++ members are not visible.
Epic's unreal module¶
In the editor, ue.to_unreal(obj) returns the unreal module wrapper of the same object, and
ue.from_unreal(obj) goes the other way.