# Creating a script to subscribe to multiple nodes with the same message id

**URL:** <https://forum.opencyphal.org/t/creating-a-script-to-subscribe-to-multiple-nodes-with-the-same-message-id/1609>\
**Category:** PyCyphal\
**Created:** [March 10, 2022, 2:55pm UTC](https://forum.opencyphal.org/t/creating-a-script-to-subscribe-to-multiple-nodes-with-the-same-message-id/1609 "2022-03-10T14:55:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rebeccaRossRobotics](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/rebeccarossrobotics/32/1387_2.png) [@rebeccaRossRobotics](https://forum.opencyphal.org/u/rebeccaRossRobotics)\
**Post date:** [March 10, 2022, 2:55pm UTC](https://forum.opencyphal.org/t/creating-a-script-to-subscribe-to-multiple-nodes-with-the-same-message-id/1609/1 "2022-03-10T14:55:08Z")

</div>

Hi!

For context, I have multiple micro-controllers which have some ToF sensors attached and I have the ToF data publishing onto my CAN network. The micro-controllers all have the same code on them apart from giving a unique node ID.

I’m currently trying to make a python script which consists of subscribers who subscribe to each micro-controller’s ToF data message. I have a script working for when there is used one micro-controller connected, but when I add a second the two nodes publishing ToF data is going into the one subscriber.

I have two nodes 23 and 24 publishing data onto Port ID 1630. What I’d like to do is the following:  
1 subscriber attached to node 23, port id 1630  
1 subscriber attached to node 24, port id 1630

Is this possible? If so, how would I construct such?

Thanks in advance  
Rebecca

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [March 10, 2022, 2:56pm UTC](https://forum.opencyphal.org/t/creating-a-script-to-subscribe-to-multiple-nodes-with-the-same-message-id/1609/2 "2022-03-10T14:56:44Z")

</div>

Are you using the legacy v0 or the modern v1?

---

<div class="post-metadata">

**Author:** ![rebeccaRossRobotics](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/rebeccarossrobotics/32/1387_2.png) [@rebeccaRossRobotics](https://forum.opencyphal.org/u/rebeccaRossRobotics)\
**Post date:** [March 10, 2022, 3:09pm UTC](https://forum.opencyphal.org/t/creating-a-script-to-subscribe-to-multiple-nodes-with-the-same-message-id/1609/3 "2022-03-10T15:09:14Z")

</div>

I’m using the modern V1

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [March 10, 2022, 3:14pm UTC](https://forum.opencyphal.org/t/creating-a-script-to-subscribe-to-multiple-nodes-with-the-same-message-id/1609/4 "2022-03-10T15:14:55Z")

</div>

The idiomatic approach is to publish the data from different sensors on different subjects. Segregation by source node-ID is, in general, incompatible with the [publish-subscribe](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern) architecture.

This and other architectural concepts (with examples) are covered in detail in the [UAVCAN Guide](https://uavcan.org/guide).

---

<div class="post-metadata">

**Author:** ![rebeccaRossRobotics](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/rebeccarossrobotics/32/1387_2.png) [@rebeccaRossRobotics](https://forum.opencyphal.org/u/rebeccaRossRobotics)\
**Post date:** [March 10, 2022, 3:28pm UTC](https://forum.opencyphal.org/t/creating-a-script-to-subscribe-to-multiple-nodes-with-the-same-message-id/1609/5 "2022-03-10T15:28:38Z")

</div>

Ok, thanks for clarifying.

I’ll speak to my colleague to see how we can modify our setup to match the ideal approach
