Get the full text of a project script?

Trying to get the full text of a python script in the project library, how would I go about doing that?

I need clarification; are you wanting to decompile a script at runtime, and view it somewhere as plain text, or are you wanting to call and run a project script function, or are you wanting to know how to put a script into the library?

View script as plain text and I just figured it out.
resource.getData("code.py"), just need to cast or otherwise turn that into a string

If you want a forward-compatible, agnostic means:
com.inductiveautomation.ignition.common.script.ModuleLibrary#deserializeScript

Accepts a ProjectResource and returns a (non-null) String.

5 Likes