![debugging python in visual studio code debugging python in visual studio code](https://code.visualstudio.com/assets/docs/languages/cpp/languages_cpp.png)
Upon completion of code modification, copy the contents of the Python file back into the tool validation. You can then open the Python file in your IDE and set breakpoints, attach the IDE to ArcGIS Pro, and run your script tool. For Python code in script tool validation (embedded in a toolbox), copy the code to an external Python file and replace the code in the Python toolbox with the example below. Remember to remove the breakpoint code upon completion of the debugging effort. Upon encountering the breakpoint, Python will enter interactive mode.
![debugging python in visual studio code debugging python in visual studio code](https://nadiah.org/wp-content/uploads/2020/02/inside_cpp_new.png)
Add a breakpoint (using import pdb pdb.set_trace()) into your script tool's code, and run a Python script that calls that script tool. Using the pdb module is useful for debugging a script tool execution code running in a stand-alone Python script. The pdb module cannot be used to debug within ArcGIS Pro, but it can be used to debug stand-alone scripts, including the execution code for script tools. It is not a fully developed IDE, but it can be used for interactive source code debugging. Press any key to close the output window. This command runs the code in the debugger, but because you haven't done anything to pause the program while it's running, it just prints a wave pattern for a few iterations. The pdb module is part of the Python standard library. Check that the code works properly by pressing F5 or selecting the Debug > Start Debugging menu command.
DEBUGGING PYTHON IN VISUAL STUDIO CODE PRO
The following ArcGIS Pro components can be debugged in P圜harm Professional edition: Earlier versions of either of these applications will not work. Microsoft Visual Studio 2017 can be used to debug ArcGIS Pro 2.1 and later.
![debugging python in visual studio code debugging python in visual studio code](https://stevenmortimer.com/blog/setting-up-vs-code-for-python-development-like-rstudio/data-viewer.png)