1

Having issues to run a model from python, below the actual code , always return module object not callable. ArcMap 10.1 using arcPy esri python 64-bit

Any ideas why?

    import arcpy

        try:
            arcpy.ImportToolbox("c:/test/geocode.tbx")
            arcpy.Model_41(<param>,<param>)
        except Exception as e:
            print e.message


error >> 'module' object is not callable

Removing try/except as suggested.

    import arcpy

    arcpy.ImportToolbox("c:/test/geocode.tbx")
    arcpy.Model_41("<param>,<param>")


error >>TypeError: 'module' object is not callable
5

It looks like you need to set a temporary alias on your toolbox (or a permanent one via its Properties) as described in the Help for ImportToolbox (arcpy):

If the toolbox does not have an alias, the module_name is required.

When a tool is accessed through the ArcPy site package, the toolbox alias where the tool is contained is a required suffix (arcpy._). Since ArcPy depends on toolbox aliases to access and execute the correct tool, aliases are extremely important when importing custom toolboxes. A good practice is to always define a custom toolbox's alias. However, if the toolbox alias is not defined, a temporary alias can be set as the second parameter.

Try this:

import arcpy
arcpy.ImportToolbox("c:/test/geocode.tbx","test")
arcpy.Model_41_test("<param>,<param>")
  • Thanks that was it , the toolbox alias name in the ImportToolbox method and then calling it by the Model name (Model_41) followed by _<toolbox alias name> (test). – Jorge Vidinha Oct 16 '14 at 12:36

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.