# Session Event Handlers on inheritable projects

**URL:** <https://forum.inductiveautomation.com/t/session-event-handlers-on-inheritable-projects/91140>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [May 30, 2024, 1:33pm UTC](https://forum.inductiveautomation.com/t/session-event-handlers-on-inheritable-projects/91140 "2024-05-30T13:33:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [May 30, 2024, 1:33pm UTC](https://forum.inductiveautomation.com/t/session-event-handlers-on-inheritable-projects/91140/1 "2024-05-30T13:33:57Z")

</div>

One of my python functions sends a message **to all projects** using  
`system.util.sendMessage`  
with scope _session_.  
All messageHandlers in all my projects run accordingly - I've programmed a messageHandler in the _Session events_ section of each project, plus a messageHandler in each view of the project that must react to the message.  
The only view that seems not to react to the message is a view in a project marked as _inheritable_: when that view is open in a project that inherits from that parent, nothing I expect happens on that view as reaction to the messageHandler (I've also tried to program a messageHadler in the _Session events_ section of the inheritable project, but with no success).

Any idea?  
Thanks in advance, regards

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 30, 2024, 2:27pm UTC](https://forum.inductiveautomation.com/t/session-event-handlers-on-inheritable-projects/91140/2 "2024-05-30T14:27:11Z")

</div>

Inheritable projects do not have an independent runtime existence. Only leaf projects actually run anything, and potentially run everything in their inheritance chain.

Due to the all-or-nothing behavior of the project resources for events, it is extremely unwise to define ~~any~~ gateway, Perspective session, or Vision client events in inheritable projects.

---

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [May 30, 2024, 2:52pm UTC](https://forum.inductiveautomation.com/t/session-event-handlers-on-inheritable-projects/91140/3 "2024-05-30T14:52:36Z")

</div>

> [@pturmel](#):
>
> it is extremely unwise to define any events in inheritable projects

Ok thanks @pturmel . But if a view in an _Inheritable_ project needs to react to a message, I cannot seem to find the way to do it: defining a messageHandler in the view itself seems to do nothing.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 30, 2024, 3:01pm UTC](https://forum.inductiveautomation.com/t/session-event-handlers-on-inheritable-projects/91140/4 "2024-05-30T15:01:40Z")

</div>

My caution only applies to session events. Message handlers on views defined in an an inheritable project but **used** in a leaf project should work just fine in that leaf project.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 30, 2024, 3:07pm UTC](https://forum.inductiveautomation.com/t/session-event-handlers-on-inheritable-projects/91140/5 "2024-05-30T15:07:21Z")

</div>

> [@pgmo](#):
>
> I've programmed a messageHandler in the _Session events_ section of each project, plus a messageHandler in each view of the project that must react to the message.

Note that there's two different 'messaging' systems at play, which causes lots of confusion, unfortunately.

`system.util.sendMessage` is the older, not-Perspective-specific, bus that was 'overloaded' to allow messaging to entire Perspective sessions. The _handlers_ for these messages are defined in 'Session Events', and as Phil noted - not generally suitable for participation in the project inheritance scheme **currently** ; _all_ your handlers, of any type, are all managed by a single project resource, so inheritance is "all or nothing". This is a limitation that we're going to address in 8.3, but worth noting right now.

`system.perspective.sendMessage`, and the component messaging _action_, meanwhile, are the _limited to Perspective_ message handling system. The handlers you define for these messages are those on individual Perspective components and views.

In other words: a `system.util.sendMessage` broadcast with a target of a specific session **will not** interact with a view or component message handler, even if it's set to 'session' listening scope.

That complication and/or the tricky interaction with project inheritance may be at the root of your issue here.

---

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [May 31, 2024, 3:04pm UTC](https://forum.inductiveautomation.com/t/session-event-handlers-on-inheritable-projects/91140/6 "2024-05-31T15:04:33Z")

</div>

> [@paul-griffith](#):
>
> `system.util.sendMessage` broadcast with a target of a specific session **will not** interact with a view or component message handler, even if it's set to 'session' listening scope

Hi @paul-griffith , thanks for your help. I know what you point out and therefore the messageHandler in the _Session Events_ of the running project (not the inheritable one) which is supposed to react to the `system.util.sendMessage` sends the message further with a `system.perspective.sendMessage`, while the final messageHandler is written in the target view, which however is defined in the inheritable project and used in the running one. Unfortunately that does not seem to work.
