# Process module logic's event within displayable node

**URL:** <https://discourse.slicer.org/t/process-module-logics-event-within-displayable-node/21742>\
**Category:** Development\
**Created:** [February 1, 2022, 10:13pm UTC](https://discourse.slicer.org/t/process-module-logics-event-within-displayable-node/21742 "2022-02-01T22:13:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [February 1, 2022, 10:13pm UTC](https://discourse.slicer.org/t/process-module-logics-event-within-displayable-node/21742/1 "2022-02-01T22:13:22Z")

</div>

Hi,

I have a module that invokes custom event `MyEvent`. I’m looking for a way to catch this event within displayable node.  
I can see an option here:

1. I can invoke the event from the module’s logic but set scene as a caller;
2. invoke the event from the logic and set the logic as a caller

If I choose the first option than `MyEvent` enum will be defined in `MyLogic.h` and the caller will be the scene. I think this is not a good idea.

If I choose the second option then it seems that I will be unable to get module instance from the displayable node and thus I will be unable to `addObserver` from the node to the logic.

Also there is a third option: from the module logic iterate through all displayable nodes and call the common method (probably `ProcessMRMLEvents`) and within this method I should process the chosen event. But I think this is also not a best choice.

Is there any recommendation?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 2, 2022, 12:31am UTC](https://discourse.slicer.org/t/process-module-logics-event-within-displayable-node/21742/2 "2022-02-02T00:31:21Z")

</div>

In your own custom app you can do it, but in Slicer we don’t let the MRML nodes know about the Logic and the Logic doesn’t know about the GUI. So if you want the displayable node to be notified the Logic would invoke the event on the node or set a value that caused the event to be invoked.

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [February 3, 2022, 6:04pm UTC](https://discourse.slicer.org/t/process-module-logics-event-within-displayable-node/21742/3 "2022-02-03T18:04:02Z")

</div>

Thank you, I will take that into account!
