I have a script that imports a custom toolbox, copies data from an sde to a file/personal gdb, removes custom feature class extensions, etc. The script runs fine in Catalog, but I receive the following error in PyScripter:

Traceback (most recent call last):
  File "C:\Clients\Custom.py", line 45, in <module>
    arcpy.UpdateMDB(gisIn, wsOut)
AttributeError: 'module' object has no attribute 'UpdateMDB'

UpdateMDB is a toolbox tool and the portion of the problem script that copies data to a file or personal gdb. The tool runs great in Toolbox. On a co-worker's machine, arcpy.UpdateMDB runs correctly in the same script, but throws an error on mine. I've also seen references for arcpy.Update_tools and arcpy.UpdateMDB_Company_Tools in help documents, but these also throw an error.

In the problematic script, I'm importing my custom toolbox like this:

tbx = r'C:\Program Files\ArcGIS\ArcToolbox\Toolboxes\Company Tools.tbx'

I'm running ArcGIS 10.2.2 on a 32-bit computer. We do a lot of testing in PyScripter, so I'm trying to figure this one out. It seems like it could be an easy fix - any ideas?

  • Sounds like a Python Path issue. Both ArcMap and Catalog use python in some like "C:\Python27\ArcGIS10.3" pyScripter may be set to use a different interpreter. Commented Mar 8, 2016 at 16:47
  • At the top of the script, I sometimes add the script folder to PythonPath. thisdir = os.path.dirname(os.path.realpath(file)) sys.path.append(thisdir)
    – klewis
    Commented Mar 8, 2016 at 19:19
  • Have you tried passing tbx to the arcpy.ImportToolbox function?
    – Nxaunxau
    Commented Mar 8, 2016 at 23:22

2 Answers 2


Try this tbx = arcpy.ImportToolbox (path_to_tbx)


Thanks for the responses. The problem seemed to be that the custom toolbox was located in two locations and was causing a conflict. The toolbox was located in the default location: C:\Program Files\ArcGIS\ArcToolbox\Toolboxes\Company Tools.tbx and also here: C:\Program Files\ArcGIS\Desktop10.2\ArcToolbox\Toolboxes\Company Tools.tbx

Before deleting the duplicate, I tried renaming the tbx and then changing the alias, but this did not work.

Once the tbx under Desktop10.2 was deleted, the scripts ran correctly. Having duplicate toolboxes was not a problem when running the tools from ArcCatalog and ArcMap python windows, only when testing in PyScripter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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