<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Problem accessing ModelBuilder variable in a python script? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-accessing-modelbuilder-variable-in-a/m-p/98952#M7661</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear ArcPy &amp;amp; Python Folk,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to make a fairly simple model in ArcGIS10.1 ModelBuilder to do the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i) Iterate through a polygon feature layer (High_resolution.shp).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ii) As each new polygon is selected fire up a python script (Zoomer1.py) that zooms to the selected polygon and exports a Geojpeg&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Model looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]16405[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Code for the Zoomer1.py script looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy&amp;nbsp; mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd,"Imagery")[0] lyr = arcpy.mapping.ListLayers(mxd, "High_resolution", df)[0]&amp;nbsp; # Use the SelectLayerByAttribute tool to select and&amp;nbsp; # zoom to the selection&amp;nbsp; arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", "AreaID = '%output_value%'") df.zoomToSelectedFeatures() arcpy.RefreshActiveView()&amp;nbsp; # Export the map to a .jpg&amp;nbsp; # Next Line Wrong! Outputs a jpeg actually called "test%output_value%.jpg" # outfile = "C:/Test/test" + "%output_value%" + ".jpg"&amp;nbsp; # Next Line Wrong! Gives Syntax error # outfile = "C:/Test/test" + %output_value% + ".jpg"&amp;nbsp; # Works.... outfile = "C:/Test/test1.jpg"&amp;nbsp; arcpy.mapping.ExportToJPEG(mxd, outfile, df, df_export_width=1600, df_export_height=1200, world_file=True)&amp;nbsp; # Clear the selection and refresh the active view arcpy.SelectLayerByAttribute_management(lyr, "CLEAR_SELECTION") arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My problem:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can not get the Exported Jpeg filename to change each time for a new polygon.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ideally I would like a series of output jpegs for each poly: test1.jpg. test2.jpg, test3.jpg, etc....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Current script is not able to recognize the ModelBuilder variable %output_value% when trying to form the outfile name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I can leave the output file as static name (eg. "C:/Test/test1.jpg") and then manually periodically check it: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It is working correctly and a new geojpeg for each polygon is being made (but unfortunately overwriting the previous jpeg).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Quite confused as this would indicate that the ModelBuilder variable is getting passed correctly to the Zommer1.py script eg:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", "Area = '%output_value%'")"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;is working correctly....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So how do I successfully use the ModelBuilder %output_value% to make sequential filenames???&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Or is there some other work-around? Didn't really expect this to be such a problem.... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS. I also observe that arcpy.RefreshActiveView() is also not updating the screen for each new polygon (which would be nice).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks in advance for your advice,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ian Thomas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Jul 2012 00:18:44 GMT</pubDate>
    <dc:creator>IanThomas1</dc:creator>
    <dc:date>2012-07-26T00:18:44Z</dc:date>
    <item>
      <title>Problem accessing ModelBuilder variable in a python script?</title>
      <link>https://community.esri.com/t5/python-questions/problem-accessing-modelbuilder-variable-in-a/m-p/98952#M7661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear ArcPy &amp;amp; Python Folk,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to make a fairly simple model in ArcGIS10.1 ModelBuilder to do the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i) Iterate through a polygon feature layer (High_resolution.shp).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ii) As each new polygon is selected fire up a python script (Zoomer1.py) that zooms to the selected polygon and exports a Geojpeg&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Model looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]16405[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Code for the Zoomer1.py script looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy&amp;nbsp; mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd,"Imagery")[0] lyr = arcpy.mapping.ListLayers(mxd, "High_resolution", df)[0]&amp;nbsp; # Use the SelectLayerByAttribute tool to select and&amp;nbsp; # zoom to the selection&amp;nbsp; arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", "AreaID = '%output_value%'") df.zoomToSelectedFeatures() arcpy.RefreshActiveView()&amp;nbsp; # Export the map to a .jpg&amp;nbsp; # Next Line Wrong! Outputs a jpeg actually called "test%output_value%.jpg" # outfile = "C:/Test/test" + "%output_value%" + ".jpg"&amp;nbsp; # Next Line Wrong! Gives Syntax error # outfile = "C:/Test/test" + %output_value% + ".jpg"&amp;nbsp; # Works.... outfile = "C:/Test/test1.jpg"&amp;nbsp; arcpy.mapping.ExportToJPEG(mxd, outfile, df, df_export_width=1600, df_export_height=1200, world_file=True)&amp;nbsp; # Clear the selection and refresh the active view arcpy.SelectLayerByAttribute_management(lyr, "CLEAR_SELECTION") arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My problem:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can not get the Exported Jpeg filename to change each time for a new polygon.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ideally I would like a series of output jpegs for each poly: test1.jpg. test2.jpg, test3.jpg, etc....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Current script is not able to recognize the ModelBuilder variable %output_value% when trying to form the outfile name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I can leave the output file as static name (eg. "C:/Test/test1.jpg") and then manually periodically check it: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It is working correctly and a new geojpeg for each polygon is being made (but unfortunately overwriting the previous jpeg).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Quite confused as this would indicate that the ModelBuilder variable is getting passed correctly to the Zommer1.py script eg:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", "Area = '%output_value%'")"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;is working correctly....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So how do I successfully use the ModelBuilder %output_value% to make sequential filenames???&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Or is there some other work-around? Didn't really expect this to be such a problem.... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS. I also observe that arcpy.RefreshActiveView() is also not updating the screen for each new polygon (which would be nice).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks in advance for your advice,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ian Thomas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jul 2012 00:18:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-accessing-modelbuilder-variable-in-a/m-p/98952#M7661</guid>
      <dc:creator>IanThomas1</dc:creator>
      <dc:date>2012-07-26T00:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Problem accessing ModelBuilder variable in a python script?</title>
      <link>https://community.esri.com/t5/python-questions/problem-accessing-modelbuilder-variable-in-a/m-p/98953#M7662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This thread may provide the answer you're looking for, appears you have to pass those values using arcpy.GetParameter statements.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That said, you could probably use a search cursor or an update cursor like this within your zoomer script and accomplish the same thing (warning, i haven't tested this code, its purely conceptual at this point, so there are things you might have to explore and finesse to make it work exactly how you want it):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd,"Imagery")[0]
lyr = arcpy.mapping.ListLayers(mxd, "High_resolution", df)[0]

#Create a variable to hold the value you want to update in your table - can be set as a raw_input variable if you want to have
#the user input this at the beginning of the model run
#or you can hard code it in the script
value = 'XXX' 
#create an update cursor
rows = arcpy.UpdateCursor(lyr,'','','calcField;FeatID')
#step through each row of the cursor, and perform all the actions you want while pointed at that row
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.calcField = value #changes the value of the calcField attribute but doesn't make it permanent 
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRows(row) #updates the row so the change is permanent
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", '\"AreaID\" =' + row.FeatID)
&amp;nbsp;&amp;nbsp;&amp;nbsp; df.zoomToSelectedFeatures()
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()
&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile = "C:/Test/test1.jpg"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToJPEG(mxd, outfile, df, df_export_width=1600, df_export_height=1200, world_file=True)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(lyr, "CLEAR_SELECTION")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:10:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-accessing-modelbuilder-variable-in-a/m-p/98953#M7662</guid>
      <dc:creator>ChristopherThompson</dc:creator>
      <dc:date>2021-12-11T06:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Problem accessing ModelBuilder variable in a python script?</title>
      <link>https://community.esri.com/t5/python-questions/problem-accessing-modelbuilder-variable-in-a/m-p/98954#M7663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Greetings Chris,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks for the advice....&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately I'm not sure yet how your suggested solutions can be implimented for my particular problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I actually need to eventually implant my python script in a much larger model...so I really need the ModelBuilder to do the "Iteration Feature Selection" (and other things) before firing up the python script. With this requirement in mind creating a cursor inside the script itself instead is unfortunately not a useable solution. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regarding your other suggestion:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried using arcpy.GetParameterAsText(0) but without success. Actually still really struggling to find out how to do this properly...it would seem a very good thing to be able to do in so many other situations as well not just for this particular problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Specifically I could summarize my problem to a more general question:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My model (in ModelBuilder) keeps updating a variable, %output_value%, that is the only precondition to a python script (also in the model).&amp;nbsp; How do you successfully pass that variable (from ModelBuilder to the python script) so that it becomes an in-script variable (eg. InScriptVar) equal to the new value of&amp;nbsp; %output_value%&amp;nbsp; each time the python script is called. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The following attempt unfortunately does not appear to work...&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;InScriptVar = arcpy.GetParameterAsText(0)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Result InScriptVar does not receive anything....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS. Incidentally what is the easiest way/trick to see what is going on with variables inside a python script when it is executing embedded inside of a ModelBuilder workflow?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks again for all your advice.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Jul 2012 00:39:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-accessing-modelbuilder-variable-in-a/m-p/98954#M7663</guid>
      <dc:creator>IanThomas1</dc:creator>
      <dc:date>2012-07-28T00:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: Problem accessing ModelBuilder variable in a python script?</title>
      <link>https://community.esri.com/t5/python-questions/problem-accessing-modelbuilder-variable-in-a/m-p/98955#M7664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear ArcPy &amp;amp; Python Folk, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I now find the relevant help section here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Integrating_scripts_within_a_model/002w0000006n000000/" rel="nofollow" target="_blank"&gt;&lt;BR /&gt;'&amp;gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Integrating_scripts_within_a_model/002w0000006n000000/&lt;BR /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;which mentions setting up parameter properties on the script &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and then shows the use of the following example setup code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; import sys, string, os, arcgisscripting gp = arcgisscripting.create(9.3) tablePath = gp.GetParameterAsText(0)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But only provides just one example... &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Little bit of ArcPy Voodoo there...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What exactly is "arcgisscripting" and where is this python module more fully documented?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this still the best way to do things in ArcGIS 10.1? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Where are there more examples of doing this? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can now alter my script as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy import sys, string, os, arcgisscripting gp = arcgisscripting.create(9.3)&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd,"Imagery")[0] lyr = arcpy.mapping.ListLayers(mxd, "High_resolution", df)[0]&amp;nbsp; # Trying to get %output_value% as an in-script variable scriptVar = gp.GetParameterAsText(0)&amp;nbsp; # Use the SelectLayerByAttribute tool to select and&amp;nbsp; # zoom to the selection&amp;nbsp; arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", "Area = '%output_value%'") df.zoomToSelectedFeatures() arcpy.RefreshActiveView()&amp;nbsp; outfile = "test" + scriptVar + ".jpg"&amp;nbsp; arcpy.mapping.ExportToJPEG(mxd, r"C:\Test\\" + outfile, df, df_export_width=1600, df_export_height=1200, world_file=True)&amp;nbsp; # Clear the selection and refresh the active view arcpy.SelectLayerByAttribute_management(lyr, "CLEAR_SELECTION") arcpy.RefreshActiveView() &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And I finally get a test1.jpg...test2.jpg...test3.jpg&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;indicating the ModelBuilder %output_value% has been successfully &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;passed to scriptVar one time also correctly zooming to the first polygon:)!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks for the advice.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ian&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Jul 2012 03:40:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-accessing-modelbuilder-variable-in-a/m-p/98955#M7664</guid>
      <dc:creator>IanThomas1</dc:creator>
      <dc:date>2012-07-28T03:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem accessing ModelBuilder variable in a python script?</title>
      <link>https://community.esri.com/t5/python-questions/problem-accessing-modelbuilder-variable-in-a/m-p/98956#M7665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My apologies, I apparently didn't provide you a link to another post as i intended in my earlier response.&amp;nbsp; The link that I think providesthe answer you are looking for: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/23570-how-to-pass-a-variable-to-a-python-script-in-model-builder"&gt;http://forums.arcgis.com/threads/23570-how-to-pass-a-variable-to-a-python-script-in-model-builder&lt;/A&gt;&lt;SPAN&gt; see if that helps.&amp;nbsp; You were on the right track i think, just need to use a different method than GetParameterAsText.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Jul 2012 11:45:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-accessing-modelbuilder-variable-in-a/m-p/98956#M7665</guid>
      <dc:creator>ChristopherThompson</dc:creator>
      <dc:date>2012-07-29T11:45:46Z</dc:date>
    </item>
  </channel>
</rss>

