# Can you edit a Blueprint Variable from Python?

**URL:** <https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147>\
**Category:** Editor Scripting\
**Tags:** unreal-engine\
**Created:** [March 4, 2019, 11:36pm UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147 "2019-03-04T23:36:48Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam.Kelsey](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/adam.kelsey/32/1016239_2.png) [@Adam.Kelsey](https://forums.unrealengine.com/u/Adam.Kelsey)\
**Post date:** [March 4, 2019, 11:36pm UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147/1 "2019-03-04T23:36:48Z")

</div>

I have been digging around, but I have been unable to find anything that looks like a way to edit an Animation Blueprint directly. There are ways to create them and assign a skeleton but that is about where my editing stops.

I have a blueprint with an array of AnimSequences I need to edit the values of. Is this possible? The docs don’t seem to have anything that I can identify as a way…

---

<div class="post-metadata">

**Author:** ![Adam.Kelsey](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/adam.kelsey/32/1016239_2.png) [@Adam.Kelsey](https://forums.unrealengine.com/u/Adam.Kelsey)\
**Post date:** [March 5, 2019, 11:48pm UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147/2 "2019-03-05T23:48:01Z")

</div>

I would have thought that using get\_editor\_property(‘variableName’) would work on a variable but to no avail.

Is it possible to list all available editor\_properties? The would at least allow for easier investigation.

---

<div class="post-metadata">

**Author:** ![Jamie\_Dale](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jamie_dale/32/1165413_2.png) [@Jamie\_Dale](https://forums.unrealengine.com/u/Jamie_Dale)\
**Post date:** [March 6, 2019, 11:01pm UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147/3 "2019-03-06T23:01:42Z")

</div>

You can, but you need to set them on the Class Default Object (CDO) of the Blueprint Generated Class (BPGC), rather than the Blueprint asset itself (which is just a definition of how to build the BPGC). This requires the Blueprint asset itself to be compiled and up-to-date:

```auto

# get the generated class of the Blueprint (note the _C)
bp_gc = unreal.load_object(None, "/Game/MyBP.MyBP_C")
# get the Class Default Object (CDO) of the generated class
bp_cdo = unreal.get_default_object(bp_gc)
# set the default property values
bp_cdo.set_editor_property("MyFloatProp", 1.0)
bp_cdo.set_editor_property("MyBoolProp", True)

```

---

<div class="post-metadata">

**Author:** ![Adam.Kelsey](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/adam.kelsey/32/1016239_2.png) [@Adam.Kelsey](https://forums.unrealengine.com/u/Adam.Kelsey)\
**Post date:** [March 6, 2019, 11:16pm UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147/4 "2019-03-06T23:16:41Z")

</div>

Thank you! I was not aware that the objects had multiple ways of being handled.

---

<div class="post-metadata">

**Author:** ![kivenwu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kivenwu](https://forums.unrealengine.com/u/kivenwu)\
**Post date:** [June 4, 2020, 7:24am UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147/5 "2020-06-04T07:24:56Z")

</div>

hi. The above code is to get the variables of class defaults, can I get the data at runtime? For example, I get a string of characters through an editable textbox and store it in this variable. Obtained in python.

---

<div class="post-metadata">

**Author:** ![intoxicat3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@intoxicat3](https://forums.unrealengine.com/u/intoxicat3)\
**Post date:** [August 18, 2020, 11:46am UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147/6 "2020-08-18T11:46:43Z")

</div>

[USER=“2003”]Jamie Dale[/USER]  
Just trying your code and it looks like it’s not working:  
“LogPython: Error: bp\_cdo = ue.get\_default\_object(bp\_gc)  
LogPython: Error: TypeError: NativizeClass: Cannot nativize ‘Blueprint’ as ‘Class’ (allowed Class type: ‘\<any\>’)  
LogPython: Error: TypeError: NativizeObject: Cannot nativize ‘Blueprint’ as ‘Object’ (allowed Class type: ‘Class’)”

---

<div class="post-metadata">

**Author:** ![Jamie\_Dale](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jamie_dale/32/1165413_2.png) [@Jamie\_Dale](https://forums.unrealengine.com/u/Jamie_Dale)\
**Post date:** [August 18, 2020, 7:03pm UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147/7 "2020-08-18T19:03:18Z")

</div>

@intoxicat3 You’re using a Blueprint rather than its generated class. My example explicitly states that you need to use the generated class.

---

<div class="post-metadata">

**Author:** ![BlueStormGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlueStormGames](https://forums.unrealengine.com/u/BlueStormGames)\
**Post date:** [March 3, 2023, 6:16pm UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147/8 "2023-03-03T18:16:27Z")

</div>

Hi Jamie\_Dale! I was trying to find exactly it!  
But another question. What if the load\_object is a Editor Widget Utility, I already tested and your code works to get the variables of that Widget. But I can not get the components inside, like TextBox, etc…  
How can I do that ?

---

<div class="post-metadata">

**Author:** ![phil123456](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@phil123456](https://forums.unrealengine.com/u/phil123456)\
**Post date:** [April 16, 2023, 10:17am UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147/9 "2023-04-16T10:17:01Z")

</div>

> [@Jamie\_Dale](#):
>
> ```auto
> # get the generated class of the Blueprint (note the _C)
> bp_gc = unreal.load_object(None, "/Game/MyBP.MyBP_C")
> # get the Class Default Object (CDO) of the generated class
> bp_cdo = unreal.get_default_object(bp_gc)
> # set the default property values
> bp_cdo.set_editor_property("MyFloatProp", 1.0)
> bp_cdo.set_editor_property("MyBoolProp", True)
> 
> ```

TypeError: NativizeClass: Cannot nativize ‘Blueprint’ as ‘Class’ (allowed Class type: ‘’)

---

<div class="post-metadata">

**Author:** ![phil123456](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@phil123456](https://forums.unrealengine.com/u/phil123456)\
**Post date:** [April 16, 2023, 10:17am UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147/10 "2023-04-16T10:17:45Z")

</div>

how do you mean, generated class ?

how do you modify the actual BP asset ?

---

<div class="post-metadata">

**Author:** ![DW\_MaxR](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DW\_MaxR](https://forums.unrealengine.com/u/DW_MaxR)\
**Post date:** [August 31, 2023, 7:47am UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147/11 "2023-08-31T07:47:06Z")

</div>

Hello!

You can use this to get the generated class:  
`bp_class = unreal.load_object(None, bp_ref.generated_class().get_path_name())`

I also thought it was not very clear, so I made this snippet for future reference:  
[Call functions or modify properties of a Blueprint from Python | Epic Developer Community (epicgames.com)](https://dev.epicgames.com/community/snippets/aAlM/unreal-engine-call-functions-or-modify-properties-of-a-blueprint-from-python)

---

<div class="post-metadata">

**Author:** ![FutureCake](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/futurecake/32/1085599_2.png) [@FutureCake](https://forums.unrealengine.com/u/FutureCake)\
**Post date:** [March 4, 2024, 3:16pm UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147/12 "2024-03-04T15:16:17Z")

</div>

This worked, thanks a lot!

---

<div class="post-metadata">

**Author:** ![stef\_bracke](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@stef\_bracke](https://forums.unrealengine.com/u/stef_bracke)\
**Post date:** [March 11, 2024, 4:57pm UTC](https://forums.unrealengine.com/t/can-you-edit-a-blueprint-variable-from-python/123147/13 "2024-03-11T16:57:54Z")

</div>

Thank you so much!
