I have created a Python toolbox for work that has two tools inside. These tools use the toolbox template and so have a init, getParameterInfo, etc.
I want to be able to run one tool both standalone and call it inside other tools within that toolbox. I can't seem to get the parameters correct though.
class foo(object)
def __init__(self)
#stuff
def getParameterInfo(self):
# list parameters for UI tool
def execute(self, parameters, messages)
print parameter[0]
return
class bar(object)
def __init__(self)
#stuff
def getParameterInfo(self):
# list parameters for UI tool
def execute(self, parameters, messages)
foo("hello, world)
return
I have tried adding a parameter to the init(self, parameter) or the foo class but I can't get it to work.
I am new to Object-Oriented Programming (OOP) and ArcGIS in general.
Best Answer
The simplest option is to have your
execute
method call a function instead of doing the actual processing. This makes it easily callable by any tool.If you want those functions contained in the tool classes: