How can I get a reference to existing views in a Perspective project? I’m creating a component that requires functionality similar to Perspective’s existing embed components.
There’s no direct way to reference Views, but this will get a list of Views currently saved in any directory of the project, along with their path. Note that you would need to enter the name of your project.
import os project_name = 'MyProject' for root, dirs, files in os.walk(".\\data\\projects\\" + project_name + "\\com.inductiveautomation.perspective\\views"): for file in files: if file.endswith('view.json'): system.perspective.print(root.split('views'))