Access spawned EditorUtilityWidget

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:

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?