
Changing the method's signature (arguments or function name) would prevent the component from calling it correctly. You will find that you are unable to edit the function's signature or docstring. The built-in documentation will contain descriptions for the arguments the Extension Function takes in as well as its return value, if any. Each component Extension Function comes with its own documentation built-into the function's default implementation using a standard Python "docstring". When you write an Extension Function, there is no event object so the component is given to you as the self object instead. Notice that this is different than Event Handler scripts where you are also given an event object in your scope.

The value of self will always be the component itself. That is because these are methods that belong to the component's class itself, instance methods. Following Python object-oriented methodology, each extension function's first argument is called self. Your subclass can then override and implement parts of the functionality of the component itself, in Python. From an object-oriented point of view, Extension Functions create a custom "subclass" of the base component type. This function is called by the Alarm Status Table for each event before it is displayed in the table and it allows users to control what alarm events are displayed on the table or not. For example, the Perspective Alarm Status Table has an Extension Function named filterAlarm.

Extension Functions are often called when the component first loads on a view or when it receives new input. Extension Functions differ from Event Handlers in that they are not event driven and are called by their component for a specific purpose when appropriate. These functions are generally more advanced and require better understanding of Python. They allow users to add extended functionality to the component via scripting.

Perspective scripting is particularly powerful, and can be used to control and fine-tune many aspects of project design.įor a more general view of scripting in Ignition, and an introduction to Python, see Scripting in our Ignition Platform section.

This section is designed to familiarize you with some of the basics of Python scripting in Perspective.
