ubanide

Passing Feature class parameter to python

Discussion created by ubanide on Dec 29, 2011
Latest reply on Dec 30, 2011 by ubanide
I have a python script that does stuff to a feature class lets call it foo_feature is is stored in a file geodatabase call mydefgdb.gdb. 

In my code I do this

import arcpy
from arcpy import env

env.workspace = "d:/mydir/projects/defworkspace/mydefgdb.gdb

gdb_to_be_moded = "foo_feature"

Then I do all kinds of stuff to the FC.
Works fine.

What I would like to know is in arcmap/toolbox when I add this script as a add->(script) is lets me set up parameters. How do I  code it so that my python script will accept the parameter from the desktop?

I created a parameter called gdb_to_be_moded and when I run it, it asks for a fc and I give it and then the script runs with the hard coded info. not the new name I am trying to pass in.

Thanks

Outcomes