# Delete all sources in the pipeline programatically?

**URL:** https://discourse.paraview.org/t/delete-all-sources-in-the-pipeline-programatically/3864
**Category:** Development
**Tags:** python
**Created:** [March 22, 2020, 9:51pm UTC](https://discourse.paraview.org/t/delete-all-sources-in-the-pipeline-programatically/3864 "2020-03-22T21:51:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![majo\_vlas](https://discourse.paraview.org/user_avatar/discourse.paraview.org/majo_vlas/32/2567_2.png) [@majo\_vlas](https://discourse.paraview.org/u/majo_vlas)
#### Post date: [March 22, 2020, 9:51pm UTC](https://discourse.paraview.org/t/delete-all-sources-in-the-pipeline-programatically/3864/1 "2020-03-22T21:51:12Z")

</div>

Is there a way to delete all the sources with their “child’s” and everything in the pipeline programmatically?

Something like

```auto
for x in GetSources():
    Delete(x)

```

?

---

<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: [March 23, 2020, 1:57am UTC](https://discourse.paraview.org/t/delete-all-sources-in-the-pipeline-programatically/3864/2 "2020-03-23T01:57:24Z")

</div>

```
for x in GetSources().values():
  Delete(x[0])
```

---

<div class="post-metadata">

### Author: ![jfavre](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@jfavre](https://discourse.paraview.org/u/jfavre)
#### Post date: [March 23, 2020, 8:50am UTC](https://discourse.paraview.org/t/delete-all-sources-in-the-pipeline-programatically/3864/3 "2020-03-23T08:50:37Z")

</div>

> [@mwestphal](#):
>
> for x in GetSources().values():

My experience with PV5.8 is that this is not sufficient because it does not clean memory. I much prefer a

`ResetSession()`

What do you think?

---

<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: [March 23, 2020, 8:51am UTC](https://discourse.paraview.org/t/delete-all-sources-in-the-pipeline-programatically/3864/4 "2020-03-23T08:51:39Z")

</div>

I do prefer ResetSession, but it does much more than just deleting the sources.
