# New script not recognized

**URL:** <https://forum.inductiveautomation.com/t/new-script-not-recognized/81485>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [November 3, 2023, 8:05pm UTC](https://forum.inductiveautomation.com/t/new-script-not-recognized/81485 "2023-11-03T20:05:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [November 3, 2023, 8:05pm UTC](https://forum.inductiveautomation.com/t/new-script-not-recognized/81485/1 "2023-11-03T20:05:31Z")

</div>

Dears,  
After I made new script and added a function into it  
`Refresh_po_lines_paperless.refresh_PO()`

and tested ,I found It is not recognized and cannot be used in my application.

I found this in the diagnostic bundle :  
`INFO | jvm 1 | 2023/11/03 22:24:09 | NameError: global name 'function_refresh_po_lines_paperless' is not defined`

then I thought I i put the function in an old script to be noticed but also not recognized and found this :  
`INFO | jvm 1 | 2023/11/03 22:53:09 | AttributeError: 'com.inductiveautomation.ignition.common.script.Pro' object has no attribute 'refresh_PO'`

what to do to let the gateway notice the new script and its function

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [November 3, 2023, 8:23pm UTC](https://forum.inductiveautomation.com/t/new-script-not-recognized/81485/2 "2023-11-03T20:23:48Z")

</div>

Functions start with def;

```auto
def foo():
   #do something

```

Show your entire code.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 3, 2023, 8:30pm UTC](https://forum.inductiveautomation.com/t/new-script-not-recognized/81485/3 "2023-11-03T20:30:40Z")

</div>

> [@samer\_samy](#):
>
> **function\_refresh\_po\_lines\_paperless**

> [@samer\_samy](#):
>
> **Refresh\_po\_lines\_paperless**.refresh\_PO()

These are two different library names

---

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [November 4, 2023, 1:24pm UTC](https://forum.inductiveautomation.com/t/new-script-not-recognized/81485/4 "2023-11-04T13:24:00Z")

</div>

I just changed it from function\_refresh\_po\_lines\_paperless to be Refresh\_po\_lines\_paperless ,hoping it will be recognized.  
and still not recognized.

I shared a video record to ensure that the gateway cannot recognize the function

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 4, 2023, 1:28pm UTC](https://forum.inductiveautomation.com/t/new-script-not-recognized/81485/5 "2023-11-04T13:28:21Z")

</div>

> [@Matrix\_Engineering](#):
>
> Functions start with def;
> 
> ```auto
> def foo():
> #do something
> 
> ```
> 
> Show your entire code.

We need to see your code. Can't help without it.

Also... Check that your gateway scripting project is set correctly. Tag change scripts require it to be set correctly.

---

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [November 4, 2023, 1:31pm UTC](https://forum.inductiveautomation.com/t/new-script-not-recognized/81485/6 "2023-11-04T13:31:22Z")

</div>

Thanks for your support,Can you check the uploaded video?  
It shows the functions is running properly in the script console but not recognized in the tag change scripting page,although other function is running there properly.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 4, 2023, 1:34pm UTC](https://forum.inductiveautomation.com/t/new-script-not-recognized/81485/7 "2023-11-04T13:34:30Z")

</div>

We need to see your script and how to define it in the project. Not the example of it not working.

Also... With tag change scripts you must have the gateway scripting project set. [Gateway Settings - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Gateway+Settings)

Otherwise the tag scripts cannot find the code.

---

<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:** [November 4, 2023, 1:41pm UTC](https://forum.inductiveautomation.com/t/new-script-not-recognized/81485/8 "2023-11-04T13:41:02Z")

</div>

> [@samer\_samy](#):
>
> running properly in the script console but not recognized in the tag change scripting

This provides one piece of information--that the script in question has no syntax errors. It is otherwise unhelpful to point out that a script intended for gateway scope works in the designer script console. There are so many differences between the scopes that the result is meaningless. The designer script console exists for and is appropriate for testing **Vision Client Code**. Full stop.

To test gateway-scope or Perspective-scope code, the code needs to _ **actually run in that scope** _.

---

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [November 4, 2023, 1:46pm UTC](https://forum.inductiveautomation.com/t/new-script-not-recognized/81485/9 "2023-11-04T13:46:44Z")

</div>

Thanks Pturnmel for your usual support ,excuse me as I am beginner here .It was my fault as Gateway Scripting Project need to be changed in gateway settings.

---

<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:** [November 4, 2023, 1:50pm UTC](https://forum.inductiveautomation.com/t/new-script-not-recognized/81485/10 "2023-11-04T13:50:37Z")

</div>

You should mark @bschroeder's comment as the solution, as he pointed this out first.

---

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [November 4, 2023, 1:55pm UTC](https://forum.inductiveautomation.com/t/new-script-not-recognized/81485/11 "2023-11-04T13:55:22Z")

</div>

Done 🥰 ,Many thanks guys
