# Go to specific time step in python script

**URL:** https://discourse.paraview.org/t/go-to-specific-time-step-in-python-script/376
**Category:** ParaView Support
**Created:** [July 31, 2018, 1:29pm UTC](https://discourse.paraview.org/t/go-to-specific-time-step-in-python-script/376 "2018-07-31T13:29:15Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Louis\_Steytler](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/c57346/32.png) [@Louis\_Steytler](https://discourse.paraview.org/u/Louis_Steytler)
#### Post date: [July 31, 2018, 1:29pm UTC](https://discourse.paraview.org/t/go-to-specific-time-step-in-python-script/376/1 "2018-07-31T13:29:16Z")

</div>

Hi All,

Is there a way to “jump” to a specific time step when creating an animation with a python script? I am only aware of:

GoToFirst, GoToLast, GoToNext, GoToPrevious

Any advice would be much appreciated.

Thanks very much,

Louis

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 31, 2018, 1:38pm UTC](https://discourse.paraview.org/t/go-to-specific-time-step-in-python-script/376/2 "2018-07-31T13:38:39Z")

</div>

With your reader being the active source, and n being the timestep you are looking for :

```
   reader = GetActiveSource()
   view = GetActiveView()
   times = reader.TimestepValues
   view.ViewTime = times[n]
   Render()
```

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [July 31, 2018, 1:40pm UTC](https://discourse.paraview.org/t/go-to-specific-time-step-in-python-script/376/3 "2018-07-31T13:40:02Z")

</div>

Any objections to making a utility function for moving to a particular timestep by index @utkarsh.ayachit?

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [July 31, 2018, 1:41pm UTC](https://discourse.paraview.org/t/go-to-specific-time-step-in-python-script/376/4 "2018-07-31T13:41:57Z")

</div>

> [@cory.quammen](#):
>
> Any objections to making a utility function for moving to a particular timestep by index @utkarsh.ayachit?

None, but let’s do it on the scene – same way as `GoToFirst` etc. The script @mwestphal provided is slightly different since it behaves differently if there are multiple temporal sources in the scene.

---

<div class="post-metadata">

### Author: ![Louis\_Steytler](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/c57346/32.png) [@Louis\_Steytler](https://discourse.paraview.org/u/Louis_Steytler)
#### Post date: [July 31, 2018, 7:44pm UTC](https://discourse.paraview.org/t/go-to-specific-time-step-in-python-script/376/5 "2018-07-31T19:44:14Z")

</div>

Thanks Mathieu, that solved my problem.

Louis

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [August 2, 2018, 3:07pm UTC](https://discourse.paraview.org/t/go-to-specific-time-step-in-python-script/376/6 "2018-08-02T15:07:41Z")

</div>

Ah indeed, multiple temporal sources complicate things a bit.
