Python get sequence for bake it.

I am creating a tool to automate the bake animation sequence in the level sequencer. I am using the function unreal.SequencerTools.export_anim_sequence(unreal.EditorLevelLibrary.get_editor_world(), sequencer, animSeq_copy, export_settings, animation_bindings[0], False). I have a problem with the output animSeq_copy, where the resulting sequence should be stored. I have tried two approaches:

  1. Create a new sequence and assign it using the following code:
asset_tools = unreal.AssetToolsHelpers.get_asset_tools()
factory = unreal.AnimSequenceFactory()
folder = "/Game/Animation/Seq/"
animSeq = asset_tools.create_asset("NewSequence", folder, unreal.AnimSequence, factory)

But this returns an error saying it cannot read the skeletonhierarchy.
2. Try to get the animation from the track, but after I get the section, I don’t know which property contains the anim_sequence.

Thank you for your help.

Hello Fellow UE5 enthusiasts,
I get the same error, Does anyone have solution for export/bake sequence animation? Please share the solution.

Best Regards