arcpy python autocomplete visual studio code

1502
4
11-22-2019 07:31 AM
Highlighted
Occasional Contributor

I have searched the GeoNet forums and StackOverFlow and others on my topic. Although the same question can be found on here and elsewhere I have yet to find a definitive solution that will resolve the problem. I am using VS Code to develop with ArcGIS Python API, such as arcpy and arcgis. I have VS Code setup to use the default ArcGIS Python 3 environment. But when I import arcpy VS Code will not autocomplete the arcpy modules.

I read through the VS Code docs on adding "extra paths" to settings.json file and to the Workspace settings file but I still cannot get the autocomplete to function. And the other annoyance is that VS Code will inform me of a warning that arcpy.da is not recognized even though the script will run in debug mode.

If anyone from Esri (such as Rohit Singh ) can post a detailed blog post on this subject, specifically configuring VS Code (not Visual Studio, but VS Code) to develop python scripts with arcpy and the ArcGIS Python API that would be really appreciated!

Tags (3)
4 Replies
Highlighted
MVP Esteemed Contributor

What are you using for the intellisense engine?

Reply
0 Kudos
Highlighted
New Contributor II

If VS Code has the python module installed and the python interpreter is the same as the one in your ArcGIS environent then it should work. Here are some more details that may be useful.

installation - Setting up Python/ArcPy with ArcGIS Pro and Visual Studio? - Geographic Information S... 

Reply
0 Kudos
Highlighted
Occasional Contributor II

Ran into this problem today.  Arcpy functions and classes autocomplete. Arcpy modules do not - neither PyCharm nor VS Code can "see" into them.  It would be nice to see an official Esri response on this.

Reply
0 Kudos
Highlighted
Regular Contributor

I usually work in Jupyter Notebooks when working with arcpy and only use Code for web development, so I hadn't noticed. But I see what you're saying...

When I try to get info about arcpy.mp:

But once inside, I get more info on everything ...

Reply
0 Kudos