-

ST Parser Error (STP0031): Invalid method instance.

The ST parser detected a syntactical fault in a method call.

Internal call of a method

Internal calls are possible for methods with the access specifier 'Public' and 'Private'. Internal means, the method is called in the user-defined function block POU where it is defined.

In ST, the method name must be preceded by the keyword 'THIS' followed by a dot. Even if no parameters are required, it must end with parentheses "()".

Example:
MyVar := THIS.Method1();

External call of a method

External calls are only possible for methods with the access specifier 'Public'. External means, the method is called from another POU (program or FB).

For the external method call, the instance name of the function block which contains the method must be included in the call. Therefore, this FB instance name must be declared in the variables table of the calling POU.

In ST, the method name must be preceded by the FB instance name followed by a dot. Even if no parameters are required, it must end with parentheses "()".

Example:
MyVar := FBSamplePOU.MyMethod();

Further Info
For further details, refer to the topic "Methods of FBs".