# \[Question\] Is there a way to access Perspective Views in the Script Console?

**URL:** <https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202>\
**Category:** Ignition Early Access\
**Created:** [January 29, 2019, 7:34pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202 "2019-01-29T19:34:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe.friedrich](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joe.friedrich/32/7505_2.png) [@joe.friedrich](https://forum.inductiveautomation.com/u/joe.friedrich)\
**Post date:** [January 29, 2019, 7:34pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/1 "2019-01-29T19:34:08Z")

</div>

Using the system.gui.getWindow(‘Window Name’) call, one can access vision Windows and their subsequent components. Is there a similar way to access Perspective Views in the Script Console?

(edit: Clarified question.)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [January 29, 2019, 9:01pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/2 "2019-01-29T21:01:53Z")

</div>

There is no **function** to access Views in such a manner.

Views and their properties should be addressed via property-accessing:

`self.view.custom.some_property`

An Embedded View (named ‘EmbeddedView’) would be accessed in the following manner:

`self.view.getChild('EmbeddedView').custom.some_other_property`

---

<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:** [January 29, 2019, 9:11pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/3 "2019-01-29T21:11:55Z")

</div>

There’s no ‘self’ in the script console… 😐

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [January 29, 2019, 9:20pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/4 "2019-01-29T21:20:53Z")

</div>

Whoops - I read the whole Thread title except for the last word… 😬

There is absolutely no way to access anything perspective in the script console because - as you just said - there is no self in the Script Console. Everything in Perspective needs some idea of context (am I checking _my_ properties? Am I checking the properties of _my_ sibling/view?)

That being said, the system.perspective function calls will not work in the Script Console either because they all require a sessionId or pageId behind-the scenes. This is either provided by the user to target a specific page, or it defaults to the sessionId/pageId currently in use. You really don’t want to try something like `system.perspective.navigate(view='my_view')` in the script console - in fact, the script console even notifies you that there is no system attribute ‘perspective’ available in the Script Console when you try.

---

<div class="post-metadata">

**Author:** ![joe.friedrich](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joe.friedrich/32/7505_2.png) [@joe.friedrich](https://forum.inductiveautomation.com/u/joe.friedrich)\
**Post date:** [January 29, 2019, 9:23pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/5 "2019-01-29T21:23:40Z")

</div>

> You really don’t want to try something like `system.perspective.navigate(view='my_view')` in the script console…

I already have 😁

Thanks for the explaination.

---

<div class="post-metadata">

**Author:** ![Aaron\_Ekstrand](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Aaron\_Ekstrand](https://forum.inductiveautomation.com/u/Aaron_Ekstrand)\
**Post date:** [December 22, 2021, 11:14pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/6 "2021-12-22T23:14:49Z")

</div>

I have a related problem. I am using Perspective and trying to refreshBinding on a component’s property. This component is on the view that is the main window, but I want to be able to do it by clicking a button on a popup.

How can I reference components on the parent view from its popup?

---

<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:** [December 23, 2021, 7:45am UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/7 "2021-12-23T07:45:13Z")

</div>

You cant, you will have to send a message on the component and a messagehandler with the same name on the main window  
[https://docs.inductiveautomation.com/display/DOC81/system.perspective.sendMessage](https://docs.inductiveautomation.com/display/DOC81/system.perspective.sendMessage)

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [July 20, 2023, 7:46pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/8 "2023-07-20T19:46:59Z")

</div>

so to be clear, from the Script Console, you **cannot** access **any** `session` or `view` props/custom for testing?

---

<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:** [July 20, 2023, 7:57pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/9 "2023-07-20T19:57:13Z")

</div>

Correct.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [July 20, 2023, 8:18pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/10 "2023-07-20T20:18:06Z")

</div>

then... ☹ how do you _actually_ test-flight scripts?? makes the console window pretty friggin' useless because you can't test an idea against any _actual_ data.

@pturmel i was both hoping you would and would NOT answer... because you'd either Show Me The Way or Horribly Crush My Hopes. 😆

---

<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:** [July 20, 2023, 9:12pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/11 "2023-07-20T21:12:32Z")

</div>

Create a gateway message handler. Put your test code for pure gateway scope stuff there, however you like.

For Perspective sessions, create a session message handler. Relay from the gateway message handler to the session handler.

For Perspective pages, create a message handler on your view, at page scope. Relay from the gateway message handler.

With the above set up (and saved), use `system.util.sendMessage()` and/or `system.util.sendRequest()` in the designer.

For Perspective views, consider making an extra button with an action event handler.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [July 20, 2023, 9:20pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/12 "2023-07-20T21:20:05Z")

</div>

that's an insane amount of circuitous effort for what should be base functionality in a development tool. what's the reasoning behind siloing the Script Console? it can't be security because i had to log in to the damn thing in the first place so i couldn't access anything i didn't have Roles or permissions for.

---

<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:** [July 20, 2023, 9:24pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/13 "2023-07-20T21:24:58Z")

</div>

Perspective is four years old. The script console is a tool developed to go with Vision, which is (counting pre-Ignition) almost 20 years old.

Perspective scripts run in the gateway. The script console runs in the designer. That is an intractable problem for Perspective. It's perfect for Vision, for which scripts are run local to the client.

Don't hold your breath. When a solution comes, it will probably be some kind of remote gateway console (entirely separate from the current designer script console).

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [July 20, 2023, 9:27pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/14 "2023-07-20T21:27:07Z")

</div>

@ian.sebryk You can cast a vote for this feature here:

> **[Script Console with Gateway Scope | Ignition Features and Ideas | Inductive...](https://ideas.inductiveautomation.com/ignition-features-and-ideas/p/script-console-with-gateway-scope)**
>
> Add a checkbox to run a script in the Script Console as though it were running on the Gateway. OR Check a box and the Script console would highlight lines that

---

<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:** [July 20, 2023, 9:28pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/15 "2023-07-20T21:28:27Z")

</div>

Yeah. **Don't hold your breath** waiting on that.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 20, 2023, 9:32pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/16 "2023-07-20T21:32:31Z")

</div>

Yeah... I don't think anybody here will argue that the feature would be useful; it seems obviously useful.

However the prospect of adding an endpoint or RPC call, the explicit purpose of which is literally _remote code execution_, is inconceivable to me.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 20, 2023, 9:37pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/17 "2023-07-20T21:37:04Z")

</div>

> [@Kevin.Herron](#):
>
> However the prospect of adding an endpoint or RPC call, the explicit purpose of which is literally _remote code execution_, is inconceivable to me.

Yeah. The counterargument is "you can already easily RCE the Gateway via the Designer", so a 'Gateway Script Console' is really just making it _slightly_ easier, and I think we are still planning to do it, but I share the same kneejerk _oh no_ reaction.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 20, 2023, 9:40pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/18 "2023-07-20T21:40:04Z")

</div>

It'll never get a +1 from me 😛

---

<div class="post-metadata">

**Author:** ![Tim\_Carlton](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim_carlton/32/52835_2.png) [@Tim\_Carlton](https://forum.inductiveautomation.com/u/Tim_Carlton)\
**Post date:** [July 21, 2023, 11:40am UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/19 "2023-07-21T11:40:54Z")

</div>

> [@ian.sebryk](#):
>
> that's an insane amount of circuitous effort for what should be base functionality in a development tool

Huh. Decades of "separate logic from presentation" and various CQRS-type patterns and whatever unit-test flavor of the week we are using make putting logic in a layer where it can be called from various places (vision, perspective, console, a fictitious IUnit framework) like an obvious thing. At least to IT developers if not OT engineers...

Lack of refactoring support OTOH...

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [July 24, 2023, 5:57pm UTC](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202/20 "2023-07-24T17:57:39Z")

</div>

fair enough. i'm refactoring like mad here, so i fully appreciate that. tech debt is an ugly thing. 😛

[Next page](https://forum.inductiveautomation.com/t/question-is-there-a-way-to-access-perspective-views-in-the-script-console/22202.md?page=2)
