# RemoveNode does not work to delete a list of node

**URL:** <https://discourse.slicer.org/t/removenode-does-not-work-to-delete-a-list-of-node/10233>\
**Category:** Support\
**Created:** [February 13, 2020, 2:28am UTC](https://discourse.slicer.org/t/removenode-does-not-work-to-delete-a-list-of-node/10233 "2020-02-13T02:28:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbuikr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tbuikr/32/3899_2.png) [@tbuikr](https://discourse.slicer.org/u/tbuikr)\
**Post date:** [February 13, 2020, 2:28am UTC](https://discourse.slicer.org/t/removenode-does-not-work-to-delete-a-list-of-node/10233/1 "2020-02-13T02:28:54Z")

</div>

I have two buttons: `Add` and `Delete`. The `Add` uses to add a node, while the `Delete` is for node removing. The `Add` function is implemented as follows:

```auto
self.roiNodes =[]
for i in range (10):
    node = slicer.vtkMRMLAnnotationROINode()
    node.SetXYZ(0, 0, 0)
    node.SetRadiusXYZ(25, 25, 25)
    node.Initialize(slicer.mrmlScene)
    node.SetName("A")            
    self.node_list.append(node)

```

The delete function will delete the node base on the seletected row in the table (10 rows)

```auto
slicer.mrmlScene.RemoveNode(self.node_list[self.table.currentRow()])
self.table.removeRow(self.table.currentRow())
self.node_list.pop(self.table.currentRow())

```

The add function works well, while the delete function does not work. Any wrong implementation in my code? Thanks

---

<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:** [February 13, 2020, 2:39am UTC](https://discourse.slicer.org/t/removenode-does-not-work-to-delete-a-list-of-node/10233/2 "2020-02-13T02:39:24Z")

</div>

There is no way we can determine where the problem is without seeing all the source code that is involved. If you cannot share tour module’s source code then create a self-contained script that reproduces the unexpected behavior.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [February 13, 2020, 2:55am UTC](https://discourse.slicer.org/t/removenode-does-not-work-to-delete-a-list-of-node/10233/3 "2020-02-13T02:55:18Z")

</div>

Only thing I could guess from your snippet is that the current row in `self.node_list.pop(self.table.currentRow())` is no longer the same as the above lines because you removed the table row in the line above.
