I have a .tbx tool box, which runs a script that is incredibly slow. So what I want to do is to open the python script that is running below the .tbx and make some changes or perhaps write something similar and faster. Is there someway to convert a .tbx ( and not just the form ) into a .py so I can inspect the code that it runs? to clarify,

it is a third party tool created as a .tbx, and specifically here: http://www.arcgis.com/home/item.html?id=c1c649ad439442189547c12685fcc9c3

it is slow in running in arcmap, but that is not the central idea, here. I want to open the python underneath the .tbx. As suggested by others i have tried to right click and export (grayed out) and also i have tried using a .tbx to .pyt converter (only returns the input form) and one more thing i has also right clicked and opened in wordpad, but it was nearly illegible.

  • Is the python script (.py) not in the folder with the toolbox (.tbx)? If not, check the properties to the script tool which will tell you where to find the source script file. Also, the code may have been imbedded into the toolbox. If this is the case, you can right-click the tool, and export the script. Be aware that it may be password protected.
    – Barbarossa
    Jun 9, 2014 at 20:38
  • export is grayed out and the properties for the script do not show a location for a .py file. I think I am outta luck, no? Jun 9, 2014 at 20:55
  • Have you tried opening the toolbox in a text editor? If you can't find the .py file that should have come with it, then it's probably embedded as @Barbarossa mentioned.
    – Paul
    Jun 9, 2014 at 21:01
  • Are you referring to ESRI tools, or script tools created by third-parties and attached to a python toolbox?
    – Aaron
    Jun 9, 2014 at 21:09
  • a script tool created by a third party.... to be specific this one: arcgis.com/home/item.html?id=c1c649ad439442189547c12685fcc9c3 Jun 9, 2014 at 21:13

2 Answers 2


For third party toolboxes, there will either be an associated python script or the script will be embedded. Check the properties of the tool to see if there is a source script file. If embedded, right-click to export script. There may be password protections.

If it is not a tool, and it seems in this case a model tool, the model can be viewed and modified in ModelBuilder. Simply right-click and edit. From ModelBuilder, you can also export the script to modify or use in a python script tool.


I'm not entirely sure if I understand your question, it leaves itself open to a few interpretations.

  • The Python itself is slow: You don't need to do any conversion. Just use the standard profiling tools the Python Standard Library offers to get some insight as to what's running slow.
  • The bookkeeping of the Geoprocessing tool is slow: If the set up and tear down of the tool is the issue, then you're mostly out of luck. All of that happens in the ArcObjects level.
  • The tool runs slow in general, and you want a Python dump of everything involved: Pretty much the source of the script tool is all the Python involved in your script tool. From there it's C++ the rest of the way down, which doesn't translate to Python.

If you want a little more control over seeing what goes on, you can use Toolbox to Python Toolbox Wrapper tool to convert your TBX files to PYTs (source code). It will also consolidate the Python source of all the scripts in your toolbox into the single file as well.

If you want more control over what goes on from there, you're going to have to go into ArcObjects. Very little of the implementation of the framework for running Python tools is actually implemented in Python.

  • and fair enough it was a bit cryptic. however, my issue is that I want to see the code behind the .tbx file to determine where I could implement some faster processing options. i cannot right click the code and export nor is there a location of the .py file in the properties so it must be embedded as barbarossa and Paul mentioned Jun 9, 2014 at 21:05
  • 2
    @fargreenhills Don't forget that you can always edit your Question to make what you are asking clearer. Comments here are intended to elicit clarifications to your original Question rather than to form a discussion.
    – PolyGeo
    Jun 9, 2014 at 21:21

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.