I have a python toolbox that is performing various operations on a layout. Reconfigure text elements, pan the map frame, export to PDF being the core functionality. Editing data is not involved.
The tool runs fine initially, but after trying a second run one of the map layers is "locked" in the layout which is causing various issues with tool execution.
My question is: Is Pro keeping variables, objects, classes, etc. in memory between tool runs? If so, how do I clear this so each tool run is new? Is the python process left running once the toolbox is opened?
Additional details:
- closing Pro and running the tool again remedies the issue - lock is only applied after second run
- Used del() to remove object and variables followed by gc.collect() at the end of the toolbox code execute to no avail
- my IDE is VS Code - running here using the approach mentioned here does not present the issue, assuming this is due to each run being a distinct process run and closure, with nothing mainted in between