Using a GetParameterAsText variable in an ArcGIS Pro calculated field code does not return the correct result of the output and does not recognize the isSame function when running through the script tool.
The CalculateField tool requires the field names within ‘!’. The user's script misses the '!'.
The following code works:
exp = "isSame(!{}!,!{}!)".format(Field1, Field2)
arcpy.management.CalculateField(LayerComp, MatchField, exp, "PYTHON3", codeblock, "TEXT", "NO_ENFORCE_DOMAINS")