import unreal
# Run with an animation sequence (`AnimSequence` asset) selected in the content browser
anim = unreal.EditorUtilityLibrary.get_selected_assets()[0]
# The C++ type of data_model_interface, declared in `UAnimSequenceBase` is `TScriptInterface<IAnimationDataModel>`
data_model = anim.data_model_interface
# Printing the object reveals the actual object type, `AnimationSequencerDataModel`
print(data_model)
# <Object '/Game/...:AnimationSequencerDataModel' (0x...) Class 'AnimationSequencerDataModel'>
# However, the Python object type is the interface type (`AnimationDataModel`)
print(type(data_model))
# <class 'AnimationDataModel'>
# Trying to access properties of the interface implementor class (`AnimationSequencerDataModel`) fails
# (as indicated in the generated docstring for `AnimationSequencerDataModel`, `animated_bone_attributes` is an editor property of the type)
anim_bone_attrs = data_model.get_editor_property('animated_bone_attributes')
# Error: Exception: AnimationDataModel: Failed to find property 'animated_bone_attributes' for attribute 'animated_bone_attributes' on 'AnimationSequencerDataModel'
# Trying to explicitly cast to the actual object type fails
anim_seq_data_model = unreal.AnimationSequencerDataModel.cast(data_model)
# Error: TypeError: AnimationSequencerDataModel: Cannot cast type 'AnimationDataModel' to 'AnimationSequencerDataModel'