Call a blueprint class function from Python

It is possible to set variables of blueprint classes from Python as shown here: Can you edit a Blueprint Variable from Python? - Editor Scripting - Unreal Engine Forums. However, it is possible to call a function that is marked as “Call in Editor”?

My specific use case is to spawn and configure a blueprint class in a level in the editor.

Once you have a reference to your Blueprint you can call one of his functions by using the method call_method(...)

Methods inherited from _ObjectBase:

x.call_method(name, args=tuple(), kwargs=dict()) → object – call a method on this object via Unreal reflection using the given ordered (tuple) or named (dict) argument data - allows calling methods that don’t have Python glue



if inside function exist local variables it’s work wierd!
It always need arguments for all local variables
actor.call_method("Test", kwargs={local_var_int': 0})

But after it ask arguments for all nodes than uses local variable!
I just print this int local variable and get this

LogPython: Error: TypeError: test() required argument 'call_func_conv_int_to_string_return_value' (pos 2) not found

But you can create new function without local variables and inside it call old function with local variables. And it work perfect!

1 Like


For future reference, here is a more complete example of how to do this, because it is not that trivial to find out exactly what to do:
Call functions or modify properties of a Blueprint from Python | Epic Developer Community (