There isn't any direct method as such for this, however using the configuration block section of the 'Open Analysis From Library' task, we can easily update any given Document Property which in turn shall trigger an Iron Python script.
Below is a sample Job XML with just a single Task as 'Open Analysis from Library' along with a configuration block section:
<?xml version="1.0" encoding="utf-8"?>
<as:Job xmlns:as="urn:tibco:spotfire.dxp.automation">
<as:Tasks>
<OpenAnalysisFromLibrary xmlns="urn:tibco:spotfire.dxp.automation.tasks">
<as:Title>Open Analysis from Library</as:Title>
<AnalysisPath>/Introduction to Spotfire</AnalysisPath>
<ConfigurationBlock>myFlag={True};</ConfigurationBlock>
</OpenAnalysisFromLibrary>
</as:Tasks>
</as:Job>
How to trigger script on property change:
Start by creating the property that triggers the script. Go to [Edit > Document Properties > Properties tab > New...]. Select the new script in the available properties list and click the 'Script...' button. Select 'Execute the script selected below' and select the script you want to execute.