Accessing window component in Project/Gateway scripts, without opening a window

I want to access a window component in project script. But it is giving me a following error.
“AttributeError: ‘com.inductiveautomation.ignition.common.script.Imm’ object has no attribute ‘gui’”.
I tried to use “import system” in project script, but still getting the same error.

Does anyone have any idea, why system.gui is not getting imported.

And how can i access window component in project scripts without opening window.

Appreciated your help

That particular error occurs when the script is running in the gateway. The gateway has no GUI, so the system.gui.* functions cannot possibly work, and are therefore omitted. Any script that needs to access a client’s windows and components needs to run as a client event script, not a gateway event script.

Can a component still be accessible event though a window is not running if try to access from client event script.

Yes but its not supported (and liable to break with Ignition updates), and is a pain to do. If you can rework things to use something else for that, that would probably be easier.

What are you trying to do exactly?