I've run into the following issue: When a Geoprocessing tool runs operations in its own Python code, it has no idea whether the user currently has unsaved edits in an ArcGIS Pro edit session. The .NET SDK gives us Project.Current.HasEdits, IsEditingEnabled, and EditedDatastores — but those are only accessible to Add-Ins running on the Main UI Thread.
Any GP tool that writes to a geodatabase outside the Pro edit session is operating blind. The user won't get a warning that their uncommitted edits are invisible to the tool, and the tool's own writes won't be visible until someone manually refreshes.
Is there any architectural intended way to not run into this problem with GP Tools? If not I would wish for the following:
arcpy.mp.ArcGISProject.hasUnsavedEdits — A simple yes/no on whether the project has uncommitted edits. Basically the Python equivalent of Project.Current.HasEdits.
arcpy.mp.ArcGISProject.isEditingEnabled — Whether the editing toggle is even active.
arcpy.mp.ArcGISProject.editedDatastores — A list showing which datastores have pending edits. This would let a tool check if its specific workspace is affected.
Ideally: A declarative flag in the tool definition like requiresNoEditSession = True. Similar to canRunInBackground, this would let Pro gray out the Run button or show a warning if there are unsaved changes on any input workspace. No extra code needed in the tool itself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.