ESRI gives the option to import a script directly into a tool in your toolbox, eliminating the need for managing both the toolbox and the python script it refers to.

When you press the right mouse button on a script tool in a toolbox

I have a script tool that refers to one script, but that script uses another script (stored in the same folder). I would like to import both scripts into the tool, so that I only have to manage the toolbox. ESRI only offers the option to import one script.

How can I import both (or multiple for someone else his/her case) scripts into one tool?

1 Answer 1


No, you cannot import multiple scripts. The script tools have been originally designed to be based on a single Python without considering users writing multimodular Python tools.

The option to zip the modules with the __main__.py file doesn't work as script tool would not understand the .zip file as its source.

Running the Python scripts outside of ArcMap first producing the compiled .pyc files and then using them for the source of the script tool doesn't work either.

Your best bet is to refactor your tool into a single file using some 3rd party tools such Breeder or manually.

If you have a large tool with many modules and don't want to refactor them into a single file and you do care about the intellectual property protection, write custom GP tools using ArcObjects and C# / Java or Python extensions with C that would work with arcpy (I'd pick this one).

  • Thanks. I'll just manually create one script, since it is roughly 200 lines of code it should not be too dificult.
    – LMB
    Jul 13, 2017 at 6:06
  • One question to ask yourself is whether or not you truly need to import your scripts. See my response in this thread for an example folder structure that you could just as easily distribute.
    – mikewatt
    Jul 13, 2017 at 21:02

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.