How do we return a value from a custom .py tool, so that when I run the tool in another script, it will return a value (such as a number, string, or tuple)?
Notice in the execute class function, I attempt to return a tuple of values. However, when I run the tool in a separate script, the return value is empty.
I use the following code to import the toolbox and run the code:
```
arcpy.ImportToolbox(pyt_path, "myToolbox")
arcpy.myToolbox.HelloWorld()
```
Below is an example .py script for the tool above
```
import arcpy
from multiprocessing import Pool
class HelloWorld(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Hello World"
self.description = ""
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
params = None
return params
def isLicensed(self):
"""Set whether tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, parameters, messages):
"""The source code of the tool."""
arcpy.AddMessage("Hello World!")
# arcpy.AddMessage("Hello Jupiter!")
return ("Hello world", 1, True)
def postExecute(self, parameters):
"""This method takes place after outputs are processed and
added to the display."""
return
```