Unable to set Logical effect's parameter from another effect

use case:
in one of our custom effect we want to perform union operation from logical effect.

problem:
when we are setting

# selecting UNION OPERATION
slicer.util.getModuleWidget("SegmentationEditor").editor.OptionsGroupBox.EffectsOptionsFrame.Logical_operatorsOptionsFrame.methodSelectorComboBox.setCurrentIndex(1)

# selecting MODIFITER SEGMENT 
slicer.util.getModuleWidget("SegmentationEditor").editor.OptionsGroupBox.EffectsOptionsFrame.Logical_operatorsOptionsFrame.qMRMLSegmentsTableView.setSelectedSegmentIDs(['Segment_1'])

# selecting SELECTED SEGMENT
slicer.util.getModuleWidget("SegmentationEditor").editor.segmentTableGroupBox.Form.SegmentsTableView.setSelectedSegmentIDs(['Segment_2'])

# LOGICAL APPLY BUTTON CLICK (performing operation)
slicer.util.getModuleWidget("SegmentationEditor").editor.OptionsGroupBox.EffectsOptionsFrame.Logical_operatorsOptionsFrame.SegmentEditorLogicalEffectApply.click()

Modifier segment is selected by the code. but still Apply button is not enabled, so that we are unable to click the Apply button.

Moreover, is there any difference if we are selecting a segment by a code and when we are selecting a segment by mouse click operation?

Thank you very much in advance.

Please look at this
https://slicer.readthedocs.io/en/latest/developer_guide/modules/segmenteditor.html

And the set the parameters correspondingly

Then do:
Effect.self.onApply()

Or something pretty similar

Hope it helps

Yes, the correct way to change segmentation parameters is by modifying the segment editor node, and to run any processing you can call the methods of the segment editor effect object.

We cannot prevent developers directly manipulating Qt widgets, but then correct behavior cannot be guaranteed. If you just rearrange the layout or hide some buttons. However, simulating button clicks in arbitrary state of the effect will probably not work.