# When (what kind of circumstance) there can be more than 1 NodeReference with the same ReferenceRole?

**URL:** <https://discourse.slicer.org/t/when-what-kind-of-circumstance-there-can-be-more-than-1-nodereference-with-the-same-referencerole/24964>\
**Category:** Support\
**Tags:** python, module, extensions\
**Created:** [August 28, 2022, 5:17pm UTC](https://discourse.slicer.org/t/when-what-kind-of-circumstance-there-can-be-more-than-1-nodereference-with-the-same-referencerole/24964 "2022-08-28T17:17:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunshine](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@sunshine](https://discourse.slicer.org/u/sunshine)\
**Post date:** [August 28, 2022, 5:17pm UTC](https://discourse.slicer.org/t/when-what-kind-of-circumstance-there-can-be-more-than-1-nodereference-with-the-same-referencerole/24964/1 "2022-08-28T17:17:06Z")

</div>

Hi everyone,

I got confused when requiring a node using `ReferenceRole`.  
As far as I know about the scene file, one `NodeReferenceRole` seems to appear only once in a node description.

How can we add the 2nd `NodeReference` into a node using the same `ReferenceRole`?  
And when (at what kind of circumstance) should we call `node.GetNumberOfNodeReferences(refRole)`?

Thank you so much in advance!

---

<div class="post-metadata">

**Author:** ![sunshine](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@sunshine](https://discourse.slicer.org/u/sunshine)\
**Post date:** [August 28, 2022, 7:33pm UTC](https://discourse.slicer.org/t/when-what-kind-of-circumstance-there-can-be-more-than-1-nodereference-with-the-same-referencerole/24964/2 "2022-08-28T19:33:18Z")

</div>

not only `node.GetNumberOfNodeReferences(refRole)`,  
but also `node.GetNthNodeReference(refRole, n)`.

If we get  
`node.GetNumberOfNodeReferences(refRole) > 1 == True`, what would we get by calling

```auto
node.GetNodeReference(refRole)

```

Do we get just one node, or a list of nodes?

---

<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:** [August 29, 2022, 3:59am UTC](https://discourse.slicer.org/t/when-what-kind-of-circumstance-there-can-be-more-than-1-nodereference-with-the-same-referencerole/24964/3 "2022-08-29T03:59:35Z")

</div>

You can assign multiple nodes to the same reference role. For example, a model node node can have multiple display nodes, each using the “display” role.

Most commonly you can use convenience methods that get/set the first node for a role (such as `SetNodeReferenceID`, `GetNodeReference`). In case you may have multiple nodes for a role, you can use `GetNumberOfNodeReferences`/`GetNthNodeReference...`/`SetNthNodeReference...` methods.
