Referencing a session prop from a script library?

In theory, the InternalSession.SESSION ThreadLocal would be populated if you’re running a project script from a Perspective thread; so something like this might work:

from com.inductiveautomation.perspective.gateway.session import InternalSession

session = InternalSession.SESSION.get()

if session is not None:
	system.perspective.print(session.custom.something)
2 Likes