# Custom Library Scope?

**URL:** <https://forum.inductiveautomation.com/t/custom-library-scope/103233>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [March 4, 2025, 7:23pm UTC](https://forum.inductiveautomation.com/t/custom-library-scope/103233 "2025-03-04T19:23:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leo\_Hobbs](https://avatars.discourse-cdn.com/v4/letter/l/a88e4f/32.png) [@Leo\_Hobbs](https://forum.inductiveautomation.com/u/Leo_Hobbs)\
**Post date:** [March 4, 2025, 7:23pm UTC](https://forum.inductiveautomation.com/t/custom-library-scope/103233/1 "2025-03-04T19:23:27Z")

</div>

I created a custom python library with a single function that copies text to the clipboard in windows. It appears that my library worked, because when I imported said function in the script console, it copied the input text to the clipboard, but when I tried running the same script in a perspective client whenever someone presses a button, nothing happened. No errors or anything. Any idea why this might be happening? Do custom libraries have scope?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 4, 2025, 7:27pm UTC](https://forum.inductiveautomation.com/t/custom-library-scope/103233/2 "2025-03-04T19:27:35Z")

</div>

Scripts in the Script Libraries, run in the scope that they are called from.

When you call the script from the script console, then it will run in Vison Client/Designer scope. (e.g. it will have access to your local machine).  
When you call the same script from a perspective client then it will run in Gateway Scope. (e.g. it will not have access to your local machine).

Perspective Clients also run in a browser and as such are subject to browser securities.

Why do you need to copy text to the clipboard?

---

<div class="post-metadata">

**Author:** ![Leo\_Hobbs](https://avatars.discourse-cdn.com/v4/letter/l/a88e4f/32.png) [@Leo\_Hobbs](https://forum.inductiveautomation.com/u/Leo_Hobbs)\
**Post date:** [March 4, 2025, 7:39pm UTC](https://forum.inductiveautomation.com/t/custom-library-scope/103233/3 "2025-03-04T19:39:23Z")

</div>

> [@lrose](#):
>
> to

Thanks for the clarification!

I was just trying to experiment around; this isn't for any serious project or anything. I decided on copying text because it seemed like a simple but conceivably useful function.

---

<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:** [March 4, 2025, 7:41pm UTC](https://forum.inductiveautomation.com/t/custom-library-scope/103233/4 "2025-03-04T19:41:38Z")

</div>

> [@Leo\_Hobbs](#):
>
> conceivably useful function.

Browser malware authors would love to have unrestricted access to the end user's clipboard. There is **some** , limited, support for this in web technologies, but it isn't available in Perspective.

---

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [March 4, 2025, 7:51pm UTC](https://forum.inductiveautomation.com/t/custom-library-scope/103233/5 "2025-03-04T19:51:20Z")

</div>

You can interact with the client's clipboard using my [Periscope](https://docs.mussonindustrial.com/ignition/embr-periscope) module, as long as you have a secure context.

> [@Accessing clipboard in Perspective](https://forum.inductiveautomation.com/t/accessing-clipboard-in-perspective/100741/6):
>
> Exactly. Here's a simple example, reading the clipboard as text. # Get Clipboard Button def runAction(self, event): def withClipboard(clipboard): self.view.custom.clipboard = clipboard system.perspective.runJavaScriptAsync('''async () =\> { return await navigator.clipboard.readText() }''', {}, withClipboard) play_button View JSON
