I'm using PyScripter to do some python geocoding automation and I'm coming across the situation where I am waiting several tens of seconds for a large module to be imported.

This is very inconvenient since it makes editing and debugging much slower than could be.

I'm hoping there would be a workaround where this large module could be saved in memory so that after the first run, consecutive re-runs wouldn't need to reload the module.

Does such a workaround exist?

I found this Importing arcpy on application launch to speed up subsequent arcpy methods. However it doesn't seem to directly address what I'm experiencing, or perhaps I do not understand the answer.

If someone could clarify the answer or suggest a workaround that would be great!

The code in question is this:

import arcpy

#use arcpy stuff
  • 1
    What is the module? Feb 4, 2016 at 0:01
  • In any question about performance I think we need to see a code snippet that can be used to demonstrate it.
    – PolyGeo
    Feb 5, 2016 at 2:18
  • import arcpy #this is the code I am using... as soon as the module is called my understanding is that it's loaded into memory. Perhaps this is more of a general python question than a gis question, but as the module imported is arcpy and I imagine this experience is not isolated I thought I'd ask here.
    – Jas
    Mar 6, 2016 at 7:44
  • @Jas, import time;t = time.time();import arcpy;print(time.time()-t);t = time.time();import arcpy;print(time.time()-t) should let you know what is happening. Hopefully the first print statement isn't > 10...
    – Paul
    Dec 2, 2016 at 1:14
  • I'll try that out and see.
    – Jas
    Jan 4, 2017 at 19:30

1 Answer 1


The arcpy package is less of package of python scripts and more of an API into ArcGIS. So when you import arcpy it takes a long time to load because it is basically opening up a GUIless version of the desktop application. So however long it takes to open up ArcGIS is how long to load the arcpy package.

So the easiest way to speed up anything arcpy related is to run it from within Arc Map. There are two main ways that you can do this. Either turn the script into a geoprocessing tool or to load it into the python window inside of Arc Map. This does remove the ability to run tests from the command line, but if you adapt your scripts to run inside Arc Map you would have the speed increase that you want.

  • I don't think you understand the question. I'd like the contents of the memory which represents the loaded arcpy module, to be preserved on successive runs of the code.
    – Jas
    Jan 4, 2017 at 19:29
  • The arcpy module starts up an instance of ArcGIS so its not just the arcpy module code being stored in memory but the full application running without a GUI. So there really isnt an option to speed it up that way.
    – James
    Jan 17, 2017 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.