Take the 2-minute tour ×

Is there a way of importing arcpy during the launch of my custom built application so that any usage of arcpy methods after the fact won't require the 3-4 seconds that it takes to import the arcpy module?

I am using wxPython for my GUI library if that helps. Preferably, the import would be done right after the MainLoop() launch of my GUI. This would lock up the GUI for a few seconds, but I can mitigate user experience issues with a busyinfo message or the like.

share|improve this question
I might cross-pollinate this question to stackoverflow because it is generally relevant to the larger programming community. I am interested however in grabbing the attention of the larger arcpy/programming community here in gis.stackexchange. –  Michael Markieta Jul 16 '12 at 15:01
Please move to stackoverflow for a wider audience. –  Michael Markieta Jul 18 '12 at 3:33
arcpy is specific to ArcGIS though is 'ArcPy site-package is built closely upon Python 2.6' help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//… –  Mapperz Jul 18 '12 at 13:11

1 Answer 1

up vote 4 down vote accepted

If you import arcpy in your main module, it should stay available and not be re-imported by any sub-module. What happens when you import any module, apart from the loading, is a check and/or update to sys.modules. Any subsequent import statements check this sys.modules dictionary before going to disk to load something. If arcpy is part os sys.modules already, it will not be reloaded but rather reused.

Some interesting information is provided here.

share|improve this answer

Your Answer


