# Shorten the \`system.perspective.print\` function call

**URL:** <https://forum.inductiveautomation.com/t/shorten-the-system-perspective-print-function-call/69438>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [February 3, 2023, 9:43pm UTC](https://forum.inductiveautomation.com/t/shorten-the-system-perspective-print-function-call/69438 "2023-02-03T21:43:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [February 3, 2023, 9:43pm UTC](https://forum.inductiveautomation.com/t/shorten-the-system-perspective-print-function-call/69438/1 "2023-02-03T21:43:54Z")

</div>

I use `system.perspective.print` a ton, especially in an involved script. On a previous keyboard I had, I had a hotkey mapping to where I'd press two keys simultaneously and it'd insert `system.perspective.print("` for me, which was nice.

I decided to try to shorten this call so it would save me a few character types - whether it accomplishes this or not, you be the judge....

### Step 1: Create a new script called `sp` (or whatever you'd like to call it)

Go to the Scripting section of the designer, right-click and add a new script - I called mine `sp`.

### Step 2: Add script

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/b/cbc88a88bb77d44824e06d5d018665287d1881da.png)

```python
def pr(msg, self):
	pageId = self.page.id
	sessionId = self.session.props.id
	
	system.perspective.print(msg, pageId=pageId, sessionId=sessionId)

```

The reason why I didn't just use `print` is because I got a syntax error and I figured it wouldn't be worth digging into it.

### EDIT - STEP NOT NEEDED (thanks pturmel!) ~~Step 3: Import `sp` into your `onActionPerformed` script, for example~~

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/9/69f9621cb9158c539d6eefaef3b86b4f75bc04c6.png)

```python
#import sp

```

### Step 4: Sit back and relax

Now, instead of typing

```python
system.perspective.print("you got past that tricky bit haha have a coffee break")

```

you can just do

```python
sp.pr("please support me on pateron for more time saving perspective tips", self)

```

This saves you from typing 13 characters in each print statement, which, if your script is anything like mine and you use `system.perspective.print` about 350 times per script, is a whopping 4,550 characters.

You're welcome.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/2/32e9bede3e1b23d685e69abd07d65bc43ed2f0ae.png)

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [February 3, 2023, 10:19pm UTC](https://forum.inductiveautomation.com/t/shorten-the-system-perspective-print-function-call/69438/2 "2023-02-03T22:19:25Z")

</div>

Other combinations of script/function names:

- p.rint()
- pri.nt()
- prin.t()
- printThisMessageForMePleaseAndThankYou()

---

<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:** [February 3, 2023, 11:28pm UTC](https://forum.inductiveautomation.com/t/shorten-the-system-perspective-print-function-call/69438/3 "2023-02-03T23:28:28Z")

</div>

You should not be importing any project script. Just use it.

---

<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:** [February 4, 2023, 1:07am UTC](https://forum.inductiveautomation.com/t/shorten-the-system-perspective-print-function-call/69438/4 "2023-02-04T01:07:27Z")

</div>

🤔

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/0/300113c759790e2186158298ac21278b2e68d140.png)

It's a bit of a hack, but I wonder if capturing standard output from Perspective scoped stuff automatically is more doable than we thought...  
I'll put in a ticket to investigate this further.

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [February 4, 2023, 4:54am UTC](https://forum.inductiveautomation.com/t/shorten-the-system-perspective-print-function-call/69438/5 "2023-02-04T04:54:09Z")

</div>

Couldn't you just use

```auto
self.print("some message?")

```

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [February 4, 2023, 5:21am UTC](https://forum.inductiveautomation.com/t/shorten-the-system-perspective-print-function-call/69438/7 "2023-02-04T05:21:38Z")

</div>

I didn't know this little gem existed!!! It does look like it prints an entire view path which could be helpful or cluttering in some cases.

One benefit of a separate function is that you can then log those messages and/or insert into a help desk database if need be, all from one place. Not really for debugging, but for client-side issues in an already-deployed app.

Thank you for this tip!
