# Problem on running the same macro again.

**URL:** https://discourse.paraview.org/t/problem-on-running-the-same-macro-again/2054
**Category:** ParaView Support
**Tags:** python
**Created:** [June 15, 2019, 10:52pm UTC](https://discourse.paraview.org/t/problem-on-running-the-same-macro-again/2054 "2019-06-15T22:52:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![obas](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/o/ecccb3/32.png) [@obas](https://discourse.paraview.org/u/obas)
#### Post date: [June 15, 2019, 10:52pm UTC](https://discourse.paraview.org/t/problem-on-running-the-same-macro-again/2054/1 "2019-06-15T22:52:36Z")

</div>

When I run the macro added, it works as intended in the first run. For the second time, an error occured (Input port 1 of algorithm vtkPProbeFilter () has zero connections but is not optional.). I do not upload a dataset but can be tried with anyone.  
I have to say that this is the simplest form I obtained for this error. I have a much complicated macro but think that the source of error is the same.  
It seems that also macro finished, some residuals remain. how can I clear all things relevant to the macro after the macro run.  
Thanks.[macro.py](https://discourse.paraview.org/uploads/default/original/2X/0/0bad6edbfff4c0aabb3957ba798217505c34464f.py) (910 Bytes)

---

<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: [June 17, 2019, 8:31am UTC](https://discourse.paraview.org/t/problem-on-running-the-same-macro-again/2054/2 "2019-06-17T08:31:01Z")

</div>

That is because the second time you run, you have no active source and the first command :  
`scene=GetActiveSource()` returns an empty object.

You may want to add`SetActiveSource(scene)` at the end of your macro.

---

<div class="post-metadata">

### Author: ![obas](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/o/ecccb3/32.png) [@obas](https://discourse.paraview.org/u/obas)
#### Post date: [June 17, 2019, 10:48am UTC](https://discourse.paraview.org/t/problem-on-running-the-same-macro-again/2054/3 "2019-06-17T10:48:45Z")

</div>

Thank you so much.
