# Warning of observer from scripted module in Slicer 5.0.3

**URL:** <https://discourse.slicer.org/t/warning-of-observer-from-scripted-module-in-slicer-5-0-3/24735>\
**Category:** Development\
**Created:** [August 13, 2022, 2:53am UTC](https://discourse.slicer.org/t/warning-of-observer-from-scripted-module-in-slicer-5-0-3/24735 "2022-08-13T02:53:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![wrc](https://avatars.discourse-cdn.com/v4/letter/w/6de8d8/32.png) [@wrc](https://discourse.slicer.org/u/wrc)\
**Post date:** [August 13, 2022, 2:53am UTC](https://discourse.slicer.org/t/warning-of-observer-from-scripted-module-in-slicer-5-0-3/24735/1 "2022-08-13T02:53:18Z")

</div>

To show this warning:  
Modules-Developer Tools-Extension Wizard-Create Extension-Add Module  
Open the module just created, switch to another module, then back to this module, you can see the warning:

```auto
/Applications/Slicer.app/Contents/bin/Python/slicer/util.py:2486: UserWarning: does not have observer
  warn('does not have observer')

```

It comes from:

```auto
    if self._parameterNode is not None:
      self.removeObserver(self._parameterNode, vtk.vtkCommand.ModifiedEvent, self.updateGUIFromParameterNode)

```

This warning shows in Slicer 5.0.3, but not in the previous versions.

---

<div class="post-metadata">

**Author:** ![danpak94](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/danpak94/32/18310_2.png) [@danpak94](https://discourse.slicer.org/u/danpak94)\
**Post date:** [December 2, 2022, 3:28pm UTC](https://discourse.slicer.org/t/warning-of-observer-from-scripted-module-in-slicer-5-0-3/24735/2 "2022-12-02T15:28:57Z")

</div>

Hello, I am seeing the same warning. Have you found a solution?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 2, 2022, 3:38pm UTC](https://discourse.slicer.org/t/warning-of-observer-from-scripted-module-in-slicer-5-0-3/24735/3 "2022-12-02T15:38:46Z")

</div>

I think it has been fixed in the current version of Slicer (5.2.x or later).

---

<div class="post-metadata">

**Author:** ![danpak94](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/danpak94/32/18310_2.png) [@danpak94](https://discourse.slicer.org/u/danpak94)\
**Post date:** [December 2, 2022, 4:49pm UTC](https://discourse.slicer.org/t/warning-of-observer-from-scripted-module-in-slicer-5-0-3/24735/4 "2022-12-02T16:49:20Z")

</div>

Hi, thanks for the reply. I’m seeing the same warning on Slicer 5.2.1.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 2, 2022, 8:32pm UTC](https://discourse.slicer.org/t/warning-of-observer-from-scripted-module-in-slicer-5-0-3/24735/5 "2022-12-02T20:32:11Z")

</div>

I thought [BUG: Fix VTKObservationMixin regression · Slicer/Slicer@3a8deba · GitHub](https://github.com/Slicer/Slicer/commit/3a8deba0d30e885272a0e91c257ac8d21771d861) fixed these. @jcfr @Sunderlandkyl do you have any comments on this?

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [December 6, 2022, 5:17pm UTC](https://discourse.slicer.org/t/warning-of-observer-from-scripted-module-in-slicer-5-0-3/24735/6 "2022-12-06T17:17:46Z")

</div>

It’s an unrelated bug with the ScriptedModule template. Observers are already removed when exiting the module, however they are “removed” a second time when the user enters the module and setParameterNode() is called.

I’ve made a PR with a fix here: [BUG: Fix scripted module template observer warning by Sunderlandkyl · Pull Request #6720 · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/pull/6720)

---

<div class="post-metadata">

**Author:** ![GeneRisi](https://avatars.discourse-cdn.com/v4/letter/g/ba8739/32.png) [@GeneRisi](https://discourse.slicer.org/u/GeneRisi)\
**Post date:** [March 2, 2023, 7:58pm UTC](https://discourse.slicer.org/t/warning-of-observer-from-scripted-module-in-slicer-5-0-3/24735/7 "2023-03-02T19:58:12Z")

</div>

I am still getting this in Slicer 5.3.0 using Total Segmentator" in non-fast mode.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 3, 2023, 5:59am UTC](https://discourse.slicer.org/t/warning-of-observer-from-scripted-module-in-slicer-5-0-3/24735/8 "2023-03-03T05:59:17Z")

</div>

The fix that @Sunderlandkyl implemented in the module template had to be done in the TotalSegmentator module, too. It would be great if you could [edit the file](https://github.com/lassoan/SlicerTotalSegmentator/blob/main/TotalSegmentator/TotalSegmentator.py) accordingly and if everything works well then send a pull request with the suggested changes.
