# How to trigger a mouseClicked function for a window visonOpened?

**URL:** <https://forum.inductiveautomation.com/t/how-to-trigger-a-mouseclicked-function-for-a-window-visonopened/69115>\
**Category:** Ignition\
**Created:** [January 27, 2023, 9:57pm UTC](https://forum.inductiveautomation.com/t/how-to-trigger-a-mouseclicked-function-for-a-window-visonopened/69115 "2023-01-27T21:57:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahman.tarek](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@rahman.tarek](https://forum.inductiveautomation.com/u/rahman.tarek)\
**Post date:** [January 27, 2023, 9:57pm UTC](https://forum.inductiveautomation.com/t/how-to-trigger-a-mouseclicked-function-for-a-window-visonopened/69115/1 "2023-01-27T21:57:51Z")

</div>

Hi all,

I have a mouseclicked function in a component

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/1/715874791d3a799999a4fa5279379f5024577193.png)  
and i would like to trigger this function from the visionopened event. i tried doing the following but it doesnt work. any advice?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/1/417277a00861b542bcada913d6b7c9f06527dd30.png)

---

<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:** [January 27, 2023, 10:12pm UTC](https://forum.inductiveautomation.com/t/how-to-trigger-a-mouseclicked-function-for-a-window-visonopened/69115/2 "2023-01-27T22:12:59Z")

</div>

You cannot (well, not easily).

Move the code to a project script. Call that project script from both events.
