mboeringa2010

ArcGIS Pro bug?: Can't import custom Python module in "Calculate Value" tool of ModelBuilder

Discussion created by mboeringa2010 on Mar 29, 2018
Latest reply on Apr 2, 2018 by KKramer-esristaff

NOTE: This post is NOT about pure Python toolboxes, but ordinary ModelBuilder toolboxes enhanced with Python scripts.

 

Can ESRI confirm this? I am running into an issue where it seems Pro won't import custom Python modules / scripts in a Calculate Value tool of ModelBuilder. I can successfully import default ArcGIS Python modules like io etc, just not my own modules written as scripts. Pro bails out with a "ModuleNotFoundError".

 

To avoid confusion, with "import", I mean using a Python module import statement in the Python code textbox of the Calculate Value tools, so like:

import os

import MyModule

 

This doesn't happen in ArcMap at all. Even if the module is not imported in the toolbox, ArcMap will find it if it is located in the same folder as the toolbox. Pro fails both with a script in the same folder as the toolbox, as well as with imported scripts.

 

See the attached screenshot from Pro 2.1.2.

Attachments

Outcomes