According to these links, one can debug a Python script using Visual Studio in ArcGIS Pro. Debug Python code—ArcPy Get Started | ArcGIS Desktop
I am using ArcGIS pro version 2.5.1 and Visual studio 2019 (16.6.1) . My steps
- Downloaded the 'Python development' workload to visual studio Pro 2019.
- Edited my .py file to add some intentional errors for testing.
- Opened ArcGIS Pro with my tool and my data to be run.
- Opened my .py file in Visual Studio and added some breakpoints.
- Attached to process in Visual Studio. See image below:
- Ran my script tool in ArcGIS Pro.
The tool fails in ArcGIS Pro because it has errors but I am not re routed to Visual Studio to see the error line as I expected. I then removed the errors in the code and left only the breakpoints but I still wasn't able to hit the breakpoints. Again, the tool completed without re-routing me back to visual studio. Has anyone been able to successfully debug Python tools using Visual Studio Pro 2019 in ArcGIS Pro 2.5.1?