# How to cast result of spawn\_and\_register\_tab in Python

**URL:** <https://forums.unrealengine.com/t/how-to-cast-result-of-spawn_and_register_tab-in-python/459113>\
**Category:** Editor Scripting\
**Tags:** Python, unreal-engine, editor, question, Blueprint\
**Created:** [December 4, 2019, 6:07am UTC](https://forums.unrealengine.com/t/how-to-cast-result-of-spawn_and_register_tab-in-python/459113 "2019-12-04T06:07:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_b1aa6f5f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b1aa6f5f](https://forums.unrealengine.com/u/anonymous_user_b1aa6f5f)\
**Post date:** [December 4, 2019, 6:07am UTC](https://forums.unrealengine.com/t/how-to-cast-result-of-spawn_and_register_tab-in-python/459113/1 "2019-12-04T06:07:02Z")

</div>

I’d like to be able to spawn an EditorUtilityWidget from Python and then call functions or set properties on it. In Blueprint it works – like so:

 ![293417-bp.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/e/e/7ee340d554f33825e901bd842ed09daf33a4f42a.png)

In Python, however, I can’t seem to figure out how to cast the return value of `spawn_and_register_tab` back to the correct class. The following spawns the widget tab correctly

```
import unreal

fred_asset = unreal.EditorAssetLibrary.load_asset('/Game/fred.fred')
eus = unreal.get_editor_subsystem(unreal.EditorUtilitySubsystem)
tab = eus.spawn_and_register_tab(fred_asset)

```

but there does not seem to be a way to get access to the derived class (‘fred’) to apply a cast to the return value. I’d have expected it to be

```
fred_asset.cast(tab)

```

but that errors with

```
Cannot cast type 'EditorUtilityWidget' to 'EditorUtilityWidgetBlueprint'

```

So – what’s the correct incantation to get the equivalent of the blueprint snippet above?

---

<div class="post-metadata">

**Author:** ![Fran.Fndz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fran.fndz/32/608277_2.png) [@Fran.Fndz](https://forums.unrealengine.com/u/Fran.Fndz)\
**Post date:** [June 30, 2023, 1:06am UTC](https://forums.unrealengine.com/t/how-to-cast-result-of-spawn_and_register_tab-in-python/459113/2 "2023-06-30T01:06:45Z")

</div>

pretty sure u already found the solution,  
for people who are into this, actually is not a big issue.

just take the python outout and set directly to a variable “Editor Utility Widget”, later you can cast into your Blueprint widget.

remember that the output is an array of tab and id. If you need tahe tab output [0], and output the id as string [1].

All tat using Execute ython Script Node
