Problem with updating the Animationscene

Hello everyone, I am facing a problem with updating my animation scene. I am trying iterate over a number of frames and exporting csv file files but I am just getting csv files with same values, which means the spreadsheet doesnt update. I would be really thankful if someone can help because I am in trouble. Here is the part of my code where the problem is :

    particle_tracer.ForceReinjectionEveryNSteps = 0
    input_directory= path_for_video
    frames=from_sec_to_timesteps(pvd_path, sim_time)
    animation_scene = GetAnimationScene()
    animation_scene.NumberOfFrames = frames
    spreadSheetView1 = CreateView('SpreadSheetView')
    i = 0

    for frame in range(frames):
        
        temporalParticlesToPathlines1 = TemporalParticlesToPathlines(
            registrationName='TemporalParticlesToPathlines1',
            Input=calculator1, Selection=None)
        temporalParticlesToPathlines1.MaskPoints = 1
        temporalParticlesToPathlines1.MaxTrackLength = 10000
        temporalParticlesToPathlines1.MaxStepDistance = [1000.0, 1000.0, 1000.0]

        Show(temporalParticlesToPathlines1, spreadSheetView1, 'SpreadSheetRepresentation')
        spreadSheetView1.HiddenColumnLabels = ['Point ID', 'AngularVelocity', 'ErrorCode', 'InjectedPointId',
                                               'InjectionStepId', 'NormShearRate [1/s]',
                                               'ParticleAge', 'ParticleSourceId', 'Points', 'Points_Magnitude',
                                               'Pressure [bar]', 'Rotation', 'Screw', 'Shell', 'Temperature [C]',
                                               'TrackLength', 'TrailId', 'Velocity [m/s]',
                                               'Velocity [m/s]_Magnitude',
                                               'Viscosity [Pa s]',
                                               'Vorticity', 'vel', 'vel_Magnitude', 'Block Number']

        input_file_path = os.path.join(input_directory, f'Timestep_{i}.csv')
        ExportView(input_file_path, view=spreadSheetView1, RealNumberNotation='Fixed')

        animation_scene.GoToNext()
        animation_scene.UpdateAnimationUsingDataTimeSteps()
        i += 1

I think you should use the CSV extractor instead, and then call Save Extracts in your script, instead of using animation scene, spreadsheet and a loop.

Rationale

Extractor are writers that will be called at each timesteps when you call Save Extracts.

ParaView pipeline should mainly not be created in a temporal loop. It is intended to be created once, then executed for each timestep.

Spreadsheet is a view, not a data type. So it is not required to save csv files.

You may choose the arrays to write with Pass Arrays filter before the extractor.