Viewport not updating after simple Actor creation with Python API

I am using the Python API to script some actor instantiations, assign an animation sequence to them and set the starting position of that animation.

The script runs fine but the actor’s visuals are not updated in the editor. The position property is set to the correct value.

If I manually adjust the position value, the viewport will adjust. So will reloading the project.

How can I update the viewport in Python to reflect the changes? (or if you know how to do this in C++, let me know and I will try to get this in Python).

This is my code (minimal example):

anim_sequence: unreal.AnimSequence = unreal.load_asset(anim_sequence_path)
skeletal_mesh: unreal.SkeletalMesh = unreal.load_asset(skeletal_mesh_path)
num_frames = anim_sequence.get_editor_property("number_of_sampled_keys")
sequence_length = anim_sequence.get_editor_property("sequence_length")

for frame_idx in range(num_frames):
    actor_location = unreal.Vector(frame_idx * 30, 0, 0)
    actor_rotation = unreal.Rotator(0, 0, 0)
  
    actor: unreal.SkeletalMeshActor = unreal.EditorLevelLibrary.spawn_actor_from_object(skeletal_mesh, actor_location, actor_rotation)

    sk_component: unreal.SkeletalMeshComponent = actor.skeletal_mesh_component
    sk_component.set_animation_mode(unreal.AnimationMode.ANIMATION_SINGLE_NODE)
    sk_component.animation_data.anim_to_play = anim_sequence

    time_sec = (frame_idx / float(num_frames - 1)) * sequence_length
    sk_component.animation_data.saved_position = time_sec

Realtime mode is on