# Global name 'ui' not defined

**URL:** <https://forum.inductiveautomation.com/t/global-name-ui-not-defined/75392>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 22, 2023, 1:37pm UTC](https://forum.inductiveautomation.com/t/global-name-ui-not-defined/75392 "2023-06-22T13:37:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AMA\_nylon](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@AMA\_nylon](https://forum.inductiveautomation.com/u/AMA_nylon)\
**Post date:** [June 22, 2023, 1:37pm UTC](https://forum.inductiveautomation.com/t/global-name-ui-not-defined/75392/1 "2023-06-22T13:37:40Z")

</div>

Hi everyone,  
I have this code for authentication but I don't understand where the 'ui.openContextMenu' comes from. I searched the internet but I can't find what it is. Anyways, it throws me the error ' global name ui is not defined'.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/4/84da864263293be000fcd41c228a4cc66178b080.png)

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 22, 2023, 2:02pm UTC](https://forum.inductiveautomation.com/t/global-name-ui-not-defined/75392/2 "2023-06-22T14:02:54Z")

</div>

When posting code, please post the code itself, either using the preformatted text tool :  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/b/4bcd9c600d08660f027e3f92016086e8eecbd7b0.png)  
or enclosing your code in triple backtick (you can even specify the language to enable syntax coloring):

> ```python  
> code here  
> ```

So, from what I understand this is not your code, you inherited it and you don't understand what things do ?

Well in any case, the error is quite clear: There's nothing named `ui` in the scope of this script. So you can't use it.  
I can think of 2 reasons why it's there:

- there used to be something named `ui` (either defined here or imported) but it was removed
- the line has been partially deleted and `ui` was the name/part of the name of a method on another object. Though I can't see anything in this script that fits the bill.

PS:

> `<> None`

Please don't. Aside from the fact that I really don't like this syntax, which is purely personal, it's been deprecated for a few centuries and probably shouldn't have been part of any standard in the first place.  
Anyway, when comparing to `None`, use `is` and `is not`:

```python
foo is None
bar is not None

```

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [June 22, 2023, 2:33pm UTC](https://forum.inductiveautomation.com/t/global-name-ui-not-defined/75392/4 "2023-06-22T14:33:14Z")

</div>

check your project script library

[https://docs.inductiveautomation.com/display/DOC81/Project+Library](https://docs.inductiveautomation.com/display/DOC81/Project+Library)
