Hello everyone,
I'm trying to build an arcpy script with 3 layers of imbricated functions but I'm running a bit confused.
Here is an example of what I'm trying to achieve.
import arcpy
import blabla
#Functions
def function1(Table, Param)
intermediateTable = do something with Table and Param
def function2(param1, table1, param2, table2):
do something 1(param1, param2)
new_param1
do something 2(param1, param2)
new_param2
if param1 == "**unspecified**":
intermediateTable = function1(table1, new_param1)
newParam = new_param1
elif param2 == "aaaa":
intermediateTable = function1(table1, new_param1)
newParam = new_param1
else:
intermediateTable = function1(table2, new_param2)
newParam = new_param2
do other stuff
def function3(param1, table1, param2, table2, param3, param4, newParam, intermediateTable): #This is where all params would be called
create gdb
...
function2(param1, table1, param2, table2)
...
do something with param3, param4, newParam, intermediateTable to create finalTable
"""
<!DOCTYPE html>
<head>
do something with finalTable...
</head>
</html>
"""
if __name__=="__main__":
#Global Environment settings
with arcpy.EnvManager():
function3(*argv[1:])I can't seem to making it work. What am I doing wrong?
But weirdly, if all my functions are built into one script (aka, no functions, just repeating the code), it does not seem to need the line to "call the function"... or is it what the "if__name__ ...etc" is for?
Thanks!