# How to Pass a Custom Property to a Project Library Function in Perspective

**URL:** <https://forum.inductiveautomation.com/t/how-to-pass-a-custom-property-to-a-project-library-function-in-perspective/109391>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [August 5, 2025, 3:32pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-custom-property-to-a-project-library-function-in-perspective/109391 "2025-08-05T15:32:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ARIFRAHUMAN\_A](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@ARIFRAHUMAN\_A](https://forum.inductiveautomation.com/u/ARIFRAHUMAN_A)\
**Post date:** [August 5, 2025, 3:32pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-custom-property-to-a-project-library-function-in-perspective/109391/1 "2025-08-05T15:32:59Z")

</div>

Hello ,

I have a requirement in Perspective. I have a custom property that gets its value when a user logs in. I want to pass that custom property to a function in the project library. Is it possible to pass a custom property to a function like this? Has anyone done it before? If yes, please let me know how to do it or suggest a solution.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [August 5, 2025, 3:58pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-custom-property-to-a-project-library-function-in-perspective/109391/2 "2025-08-05T15:58:55Z")

</div>

Add an additional argument when defining the function in the project library script and pass in the property via that argument when calling the function. Very common practice, as many pass the reference to the entire view or view custom properties when scripting.

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [August 5, 2025, 3:58pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-custom-property-to-a-project-library-function-in-perspective/109391/3 "2025-08-05T15:58:58Z")

</div>

That depends on how you are invoking the script. Say you have a library script named `MyScript` with a function...

```python
def myFunction(myParam):
    ....

```

If you have a custom view property `myCustomProperty`, then in a button `onActionPerformed` you would just call it like:

```python
MyScript.myFunction(self.view.custom.myCustomProperty)

```

If you're calling it from an Expression, you use [`runScript`](https://docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/advanced/runScript):

```python
runScript('MyScript.myFunction', 0, {view.custom.myCustomProperty})

```

---

<div class="post-metadata">

**Author:** ![ARIFRAHUMAN\_A](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@ARIFRAHUMAN\_A](https://forum.inductiveautomation.com/u/ARIFRAHUMAN_A)\
**Post date:** [August 5, 2025, 4:12pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-custom-property-to-a-project-library-function-in-perspective/109391/4 "2025-08-05T16:12:24Z")

</div>

Understood. In my case, the function is being called from a **Gateway Timer Script** , not from a component or expression. The function resides in the project library and currently accepts a parameter.

However, I want to pass a **custom property value** (from a Perspective view) into that function. Since Gateway Timer Scripts run on the gateway scope and don't have access to session or view context, I'm looking for a way to **pass that custom property value** to the function when the user logs in or when the view is loaded.

Is there a recommended approach for making a **Perspective custom property available to a Gateway-scoped script** , or is there a workaround using a tag or database?

---

<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:** [August 5, 2025, 4:18pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-custom-property-to-a-project-library-function-in-perspective/109391/5 "2025-08-05T16:18:30Z")

</div>

> [@ARIFRAHUMAN\_A](#):
>
> Is there a recommended approach for making a **Perspective custom property available to a Gateway-scoped script**

No, as they are not available to gateway-only scripts.

> [@ARIFRAHUMAN\_A](#):
>
> is there a workaround

The most common approach would be to use a tag. But keep in mind that tags are share among all users. What do you expect to happen when you have more than one Perspective client running?

---

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [August 5, 2025, 4:20pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-custom-property-to-a-project-library-function-in-perspective/109391/6 "2025-08-05T16:20:07Z")

</div>

Message handler and update the timer script?

I.e. have the timer script send a message to the perspective project on message channel A  
then the perspective project has a handler that sends back the custom prop on channel B  
then the gateway has a handler on channel B that runs the actual script
