The objectsWithRole method returns all objects connected with the subject object (on which the method was invoked) via a relation with the role as specified within the parameter:

<result> = <object>.objectsWithRole( <role>[, <filter>] )

<object>

A value of type Object or an expression evaluating to a value of type Object not being a Relation

<role>

A value of type string or an expression evaluating to a value of type string: the role name.

<filter>

A value of type string or an expression evaluating to a value of type string, or a list or set of those: the type (or types) the returned objects must have (or derive from). This argument is optional: objects of all types will be returned when omitted.

<result>

A list containing elements of type Object: the objects connected to <object> via a relation with given <role>.