I have a script tool that I made a while ago in ArcGIS Pro and that connects to a Python file for execution. After updating ArcGIS Pro to version 3.2, I noticed the selection toggle button appearing in the GP tools interface. Since I did not want to use just the existing selection on one of my input layers, I switched the toggle button off.
After running the script I noticed that the output was not as expected, even though I know it worked okay before. After looking at some layers that are generated at various steps of the script, I noticed that the arcpy function arcpy.management.SelectLayerByAttribute() did make a selection, but the next function arcpy.management.CopyFeatures() made a copy of the complete layer instead of just the selection.
The other selections I use in the script are also ignored by the following arcpy function. So it seems like the "use selection" toggle button in the GP tools interface has an influence not just on the existing selection on the input layer, but on all the selections that will be made on that layer while the script is running.
I wanted to know if this is how the button was intended to work? If there is any documentation on this? Or how I can best avoid trouble with selections in the future?
(I know I can clear the selection on the input layer, and the toggle button will disappear. However, I have to remember to turn the button "on" again before clearing the selection, or it will remember that it was turned "off" and the selections will be ignored. The script tool might also be used by someone else in the future, who is not aware of this behavior.)