Download

How to expose methods of custom class to Python?

load_assets() gives me the Unreal.Object of my asset, but I’d like to run its public methods in the Editor as well. Is it possible?
Also, I noticed that PostLoad() is not called after calling load_asset(). How do I force calling UObject::PostLoad()?

Python wrapped objects are always returned as their actual type. That means that even if a function says it returns Object, if you know you’re really getting back something of type Thing, then Thing is what you’ll have to work with in Python.

You expose methods from your UObject-based types by marking them as UFUNCTION and making them BlueprintCallable or BlueprintPure (which exposes them to both Blueprints and Python).

Are you sure your asset wasn’t already loaded? load_asset will find rather than load if the asset is already in-memory.

Thanks Jamie. That was helpful. I managed to expose what I needed and you are right about the in-memory asset.