How to prompt for parameters within a loop?

618
1
08-11-2020 01:46 PM
WhitneyWeber
Occasional Contributor

I am trying to get multiple parameters (status, target_gdb,...) for each feature class within the Map. The number of feature classes is variable, so I can't set a specific number of parameters. I thought to call another python script (secondary_script) to:

  • pass 3 values (a,b,c) from the original script to the secondary_script
  • get the parameters for each feature class (x,y)
  • return two parameters (x,y) from secondary_script to original_script.

I've never done this before and it's not working, probably for various reasons, but the most basic is that the secondary_script is not prompting for the necessary parameters (x,y). Is there a way to do this, and if so, how? I also tried assigning the GetParameterAsText to (3) and (4), but that didn't work either. I'm at a loss.

Original script:

import secondary_script

# call the secondary_script

secondary_script.module_name(a,b,c)

Secondary script:

import arcpy, os
from original_script import a,b,c

x = arcpy.GetParameterAsText(0)
y = arcpy.GetParameterAsText(1)

def copyLayerToGDB(a,b,c,x,y):

....

Tags (3)
0 Kudos
1 Reply
JohannesLindner
MVP Frequent Contributor

It's very unclear to me what you're trying to do.

Dou you want to

  • get characteristics (visibility, data source, name, etc.) of all/some layers in the map?
  • set characteristics for all/some layers in the map?
  • do something else with those layers?
  • Do you need a graphical user interface?

Have a great day!
Johannes
0 Kudos