# Adding and removing nodes during runtime

**URL:** <https://forum.universal-robots.com/t/adding-and-removing-nodes-during-runtime/2119>\
**Category:** URCap Development\
**Created:** [June 14, 2018, 2:32pm UTC](https://forum.universal-robots.com/t/adding-and-removing-nodes-during-runtime/2119 "2018-06-14T14:32:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon11665646](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@anon11665646](https://forum.universal-robots.com/u/anon11665646)\
**Post date:** [June 14, 2018, 2:32pm UTC](https://forum.universal-robots.com/t/adding-and-removing-nodes-during-runtime/2119/1 "2018-06-14T14:32:08Z")

</div>

Hi, is there any way to add or remove program nodes during runtime, after the Activator’s start method ran? I found that running the unregister method on ServiceRegistration objects does nothing after the start method completed.

Thanks

---

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/ajp/32/471_2.png) [@ajp](https://forum.universal-robots.com/u/ajp)\
**Post date:** [June 14, 2018, 6:47pm UTC](https://forum.universal-robots.com/t/adding-and-removing-nodes-during-runtime/2119/2 "2018-06-14T18:47:38Z")

</div>

The program is compiled into urscript and sent to the controller to be executed, from this point onwards the structure in polyscope no longer influences it. If you need to change which lines execute i’d recommend adding statements to the program that check the general purpose registers to decide whether to execute certain commands based on those values, which can be altered externally at runtime.

---

<div class="post-metadata">

**Author:** ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)\
**Post date:** [June 15, 2018, 6:56am UTC](https://forum.universal-robots.com/t/adding-and-removing-nodes-during-runtime/2119/3 "2018-06-15T06:56:06Z")

</div>

PolyScope needs to restart, for new nodes to be registered or unregistered.  
So the short answer will be, that it is not possible to add or remove new types of program nodes, after the Activator has run in the start sequence of PolyScope.

---

<div class="post-metadata">

**Author:** ![anon42905246](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@anon42905246](https://forum.universal-robots.com/u/anon42905246)\
**Post date:** [June 15, 2018, 7:12am UTC](https://forum.universal-robots.com/t/adding-and-removing-nodes-during-runtime/2119/4 "2018-06-15T07:12:14Z")

</div>

@ajp I think he means unregistering program node service after bundle activator was called.

---

<div class="post-metadata">

**Author:** ![anon11665646](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@anon11665646](https://forum.universal-robots.com/u/anon11665646)\
**Post date:** [June 15, 2018, 8:07am UTC](https://forum.universal-robots.com/t/adding-and-removing-nodes-during-runtime/2119/5 "2018-06-15T08:07:36Z")

</div>

Thank you for the answer

---

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/ajp/32/471_2.png) [@ajp](https://forum.universal-robots.com/u/ajp)\
**Post date:** [June 15, 2018, 11:39am UTC](https://forum.universal-robots.com/t/adding-and-removing-nodes-during-runtime/2119/6 "2018-06-15T11:39:49Z")

</div>

Ah sorry for my Java ignorant response, I’ll just stick to python/linux 🙂

---

<div class="post-metadata">

**Author:** ![anon42905246](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@anon42905246](https://forum.universal-robots.com/u/anon42905246)\
**Post date:** [June 15, 2018, 11:56am UTC](https://forum.universal-robots.com/t/adding-and-removing-nodes-during-runtime/2119/7 "2018-06-15T11:56:43Z")

</div>

My life now would be so much simpler, if you chose Python as a language to create GUI. Java is driving me nuts. 😉

---

<div class="post-metadata">

**Author:** ![Savoia](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/savoia/32/4844_2.png) [@Savoia](https://forum.universal-robots.com/u/Savoia)\
**Post date:** [January 26, 2021, 10:23pm UTC](https://forum.universal-robots.com/t/adding-and-removing-nodes-during-runtime/2119/8 "2021-01-26T22:23:55Z")

</div>


