# Correct invocation of runScript?

**URL:** <https://forum.inductiveautomation.com/t/correct-invocation-of-runscript/59561>\
**Category:** General Discussion\
**Tags:** ignition81, scripting, perspective\
**Created:** [May 13, 2022, 9:38pm UTC](https://forum.inductiveautomation.com/t/correct-invocation-of-runscript/59561 "2022-05-13T21:38:39Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [May 13, 2022, 10:11pm UTC](https://forum.inductiveautomation.com/t/correct-invocation-of-runscript/59561/5 "2022-05-13T22:11:14Z")

</div>

Based on [this](https://forum.inductiveautomation.com/t/how-best-to-optimize-for-real-time-jog-buttons/59518/14) I need to resolve the server and path of a tag from its pathname in order to invoke system.opc.writeValue . As this should be constant over the life of a session I should only need to look the info up once and locally cache it. I was trying to do this in the object where the info was needed. I was choosing to do the work in a separate function than the startup event in order to better organize my code.

And what do you mean by?

> [@](#):
>
> Is there a reason you’re doing this via an expression and runscript, vs just invoking your custom method directly?

can I invoke testMethod() directly from the Startup event?

---

_[View the full topic](https://forum.inductiveautomation.com/t/correct-invocation-of-runscript/59561)._
