# Get/Set Blueprint Enum Variables in Python?

**URL:** <https://forums.unrealengine.com/t/get-set-blueprint-enum-variables-in-python/142351>\
**Category:** Editor Scripting\
**Tags:** unreal-engine\
**Created:** [April 27, 2020, 4:42pm UTC](https://forums.unrealengine.com/t/get-set-blueprint-enum-variables-in-python/142351 "2020-04-27T16:42:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![robotProdigy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robotProdigy](https://forums.unrealengine.com/u/robotProdigy)\
**Post date:** [April 27, 2020, 4:42pm UTC](https://forums.unrealengine.com/t/get-set-blueprint-enum-variables-in-python/142351/1 "2020-04-27T16:42:50Z")

</div>

So I’m having a heck of a time figuring out how to read or set Blueprint enum variables from Python. I’ve found the unreal docs on unreal.enum, and looked in that and all its superclasses, but having no luck solving this mystery. Obviously I’ve tried get\_editor\_property() and set\_editor\_property(), but those don’t work on enum variables. This is as far as I’ve gotten.

```auto

# get selected scene object
obj = unreal.EditorLevelLibrary.get_selected_level_actors()[0]

# get enum variable called 'enum'
my_enum = unreal.Enum(obj.get_outer(), 'enum')

# now what?

```

Any links or pointers appreciated.

---

<div class="post-metadata">

**Author:** ![robotProdigy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robotProdigy](https://forums.unrealengine.com/u/robotProdigy)\
**Post date:** [May 1, 2020, 7:26pm UTC](https://forums.unrealengine.com/t/get-set-blueprint-enum-variables-in-python/142351/2 "2020-05-01T19:26:19Z")

</div>

Update - So the above example is trying to access an unreal.Enum type, and this is an enum type that is generated if you create a prototype blueprint enum, then reference that blueprint to establish an enum variable in another blueprint. Looking at the C++ code for this Enum type, there are a number of important member functions that are not exposed to Python as of UE v4.24 (correct me if I’m wrong), so I feel like this is a dead-end for now.

However, I believe that that vast majority, if not all, enums already existing in Unreal’s native blueprints - which are based on C++ classes - are derived from unreal.EnumBase, and that’s much easier to read and set through Python. Since I can’t find much on Google regarding how to access this enums, I’ll post a couple of snippets to help anyone get started who needs to read or set these EnumBase derived variables through Python.

First we’ll get an actor object by selecting a pawn (or pawn derived object) in the content browser and running this.

```auto

selected_actor = get_selected_content_browser_items()[0]
bgc_asset = unreal.load_object(None, selected_actor.get_path_name() + '_C')
actor = unreal.get_default_object(bgc_asset)

```

Get the enum’s set string value

```auto

enum = actor.get_editor_property('AutoPossessAI')
enum_sel_str = enum.name
print('Enum string value: %s' % enum_sel_str)
# output
# Enum string value: PLACED_IN_WORLD

```

To get its selected index you would just use this instead

```auto

enum_sel_index = enum.value

```

And to set the enum value

```auto

auto_possess_player = actor.get_editor_property("auto_possess_player")
actor.set_editor_property('auto_possess_player', auto_possess_player.PLAYER1)

```

Cheers

---

<div class="post-metadata">

**Author:** ![NGaming\_Ale](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NGaming\_Ale](https://forums.unrealengine.com/u/NGaming_Ale)\
**Post date:** [August 5, 2021, 2:51pm UTC](https://forums.unrealengine.com/t/get-set-blueprint-enum-variables-in-python/142351/3 "2021-08-05T14:51:28Z")

</div>

My enum.value is a number and if I try to set it by ```  
actor.set\_editor\_property(‘auto\_possess\_player’, auto\_possess\_player.2)

```auto

```

---

<div class="post-metadata">

**Author:** ![blueprintiseasy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@blueprintiseasy](https://forums.unrealengine.com/u/blueprintiseasy)\
**Post date:** [October 1, 2022, 4:04am UTC](https://forums.unrealengine.com/t/get-set-blueprint-enum-variables-in-python/142351/4 "2022-10-01T04:04:34Z")

</div>

I know this thread is super old, but I am having this issue. actor.set\_editor\_property(‘auto\_possess\_player’, auto\_possess\_player.PLAYER1) does not seem to work. Anybody else know a fix for this?

---

<div class="post-metadata">

**Author:** ![blueprintiseasy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@blueprintiseasy](https://forums.unrealengine.com/u/blueprintiseasy)\
**Post date:** [October 1, 2022, 4:58am UTC](https://forums.unrealengine.com/t/get-set-blueprint-enum-variables-in-python/142351/5 "2022-10-01T04:58:50Z")

</div>

Well I managed to figure it out, although it is a slightly inconvenient approach.

```auto
def change_blueprint_default_value(blueprint_generated_class, variable_name, new_value):
    blueprint = unreal.load_object(None, blueprint_generated_class)
    some_actor_cdo = unreal.get_default_object(blueprint)
    x=some_actor_cdo.get_editor_property(variable_name)
    y=type(x).ENUMVALUE
    some_actor_cdo.set_editor_property(variable_name, y)

```

---

<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:** [September 20, 2025, 11:07am UTC](https://forums.unrealengine.com/t/get-set-blueprint-enum-variables-in-python/142351/6 "2025-09-20T11:07:19Z")

</div>

> [@robotProdigy](#):
>
> `AutoPossessAI`

and what if you want your script to find variables without knowing their name ?
