Deploying and distributing custom raster functions can now be performed seamlessly by placing any Python raster functions (.py files) and their associated raster function templates (.rft.xml files) in the well-known home folder. This folder exists on all ArcGIS products, including ArcGIS AllSource. As a developer, you need to set up this folder once and replicate it in the respective ArcGIS installation directories. Then, all your custom functions that exist in these folders will be recognized across the platform. When a user applies or publishes a custom function template, the software automatically checks this location for the associated Python script.
Before deploying custom Python raster functions, ensure that all third-party Python libraries are installed. These associated libraries and the correct version of Python must also be installed with ArcGIS AllSource. To determine the Python version, type sys.version_info in the Python window.
Now, you can start preparing the raster function templates. Open a template using a text editor or XML editor. Locate the path to the Python file in the XML editor. Change the path to the Python script it is referencing using the well-known home folder path with the following syntax: [functions]Custom\subfolder\script1.py.
Deployment in ArcGIS AllSource
You must place the associated Python scripts and raster function templates in the Custom directory in the well-known home folder, and ArcGIS Server, if applicable. When a user applies or publishes templates, the software automatically checks this location for the associated Python script. The ArcGIS AllSource well-known home folder is located at .\Program Files\ArcGIS\AllSource\Resources\Raster\Functions.
Note:
Do not copy custom functions into the System subfolder in the well-known home folder. This is reserved for out-of-the-box functions only.
Create a Custom folder in .\Program Files\ArcGIS\AllSource\Resources\Raster\Functions\Custom.
Place the raster function template and Python file in subfolders in the Custom folder. Then, they are automatically listed in the Raster Functions pane. If you do not use subfolders, the functions are not listed in the Raster Functions pane. The subfolders under the Custom folder are used as the subcategories in the Raster Functions pane. For example, if you have a category named agriculture, use the following folder structure: \Program Files\ArcGIS\AllSource\Resources\Raster\Functions\Custom\agriculture.
The Custom tab in the Raster Functions pane will then have an agriculture subcategory.

The subcategories on the Custom tab are denoted by square brackets ([ ]). You cannot edit these subcategories in ArcGIS AllSource.