Seeking help on Swapping Sprites at Runtime Without Losing Animation

I am facing an issue while trying to swap sprites at runtime without losing the animation in Unity. I have a sprite with an animation governed by SpriteSkin. I am attempting to update the sprite at runtime using a local file that the user has modified. When I update the sprite using the following code:

GetComponent<SpriteRenderer>().sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));

Although the texture is replaced, the animation stops and the bones are missing in the SpriteSkin component.

To retain the bones, I tried using SpriteDataAccessExtensions with the following code:

var bones = GetComponent<SpriteRenderer>().sprite.GetBones();
var newSprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
newSprite.SetBones(bones);
GetComponent<SpriteRenderer>().sprite = newSprite;

While this approach preserves the bones in the SpriteSkin, unfortunately, the animation does not run.

I am seeking guidance or suggestions on how I might achieve my goal of swapping sprites at runtime without losing the animation. Any insights or advice would be greatly appreciated.

Thank you for your time and assistance.