I can't get the parameters of my tool to show up in ArcGIS Pro 2.1 Because of my work I can't put my exact code here, but I'll put the skeleton of what I'm doing and hopefully someone can see what I'm doing wrong.
As a disclaimer, I know I can right click and add the parameters directly into my script tool, through pro directly, but I want to do it strictly through python so that I can add my own error messages. However, my python skills are not the strongest and I don't see where I am going wrong.
import arcpy
class Toolbox(object):
def __init__(self):
self.label = "My label"
self.alias = "The alias"
self.description = "The description of the tool"
self.tools = [MyTools]
# Functions
def firstFunction(table):
"""function stuff here"""
def secondFunction(param01):
"""function stuff here"""
# Parameter Info
class MyTools(object):
def __init__(self):
self.label = "test"
self.description = "The description of the tool"
self.canRunInBackground = True
def getParameterInfo(self):
table = arcpy.Parameter(
displayName = "TABLE",
name = "table",
datatype = ["Table", "Feature Layer"],
parameterType = "Required",
direction = "input")
param01 = arcpy.Parameter(
displayName = "param01",
name = "param01",
datatype = "Long",
parameterType = "Required",
direction = "input")
parameters = [table, param01]
return parameters
def execute(self, parameters):
table = parameters[0].valueAsText
param01 = parameters[1].valueAsText
MyTools()
firstFunction(table)
secondFunction(param01)
param01
in thedatatype = "long"
line.