I have a defined function (ex. def my_function(x,y)).
def my_function(x,y):
"""algorithm"""
my_variable = my_function(filex, filey)
How can I call this variable within the code block section of the following ArcPy statement?
CalculateField_management (in_table, field, expression, {expression_type}, {code_block})
I want to include an if/elif/else statement based on the value of my_variable. For example:
if field > my_variable:
return my_variable / 2
elif field < my_variable:
return my_variable ** 2
else:
return my_variable
I think I can just include the my_variable = my_function() at the beginning of the code block but my function is huge. Also, I don't know if CalculateField can see the function outside of the code block. There must be a better way? Thank you for your help!