# Can a Python script detect which Perspective view or binding it is running in?

**URL:** <https://forum.inductiveautomation.com/t/can-a-python-script-detect-which-perspective-view-or-binding-it-is-running-in/99937>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 17, 2024, 4:11pm UTC](https://forum.inductiveautomation.com/t/can-a-python-script-detect-which-perspective-view-or-binding-it-is-running-in/99937 "2024-12-17T16:11:14Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [December 17, 2024, 4:24pm UTC](https://forum.inductiveautomation.com/t/can-a-python-script-detect-which-perspective-view-or-binding-it-is-running-in/99937/3 "2024-12-17T16:24:51Z")

</div>

Possibly a starting point here:

> [@Get current username / Session in scripting in perspective](https://forum.inductiveautomation.com/t/get-current-username-session-in-scripting-in-perspective/47778/9):
>
> The ugly, hacky, unsupported, completely-liable-to-break-on-any-upgrade way to get magical access to the current session is using a public static ThreadLocal, as mentioned here: As my first sentence alludes - this is a bad practice, liable to break at any time.

If you just _log_ (not print!) a message, you should get useful MDC output indicating some information.

Technically you could retrieve that at runtime, via the static method on the MDC class:  
`org.slf4j.MDC.get("key")`

As in:

```python
from org.slf4j import MDC
component = MDC.get("component")

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/can-a-python-script-detect-which-perspective-view-or-binding-it-is-running-in/99937)._
