<?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 Re: Python - CalculateField using CodeBlock contained in another Python Script in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/python-calculatefield-using-codeblock-contained-in/m-p/1171139#M54802</link>
    <description>&lt;P&gt;Sorry for the short lived post, but I solved it....&lt;/P&gt;&lt;P&gt;I was using incorrect syntax.&amp;nbsp; The syntax should have been:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;arcpy.management.CalculateField(fc,'Notes','SentenceCase.subsmade(!Notes!)','PYTHON3', 'import SentenceCase')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 May 2022 15:58:20 GMT</pubDate>
    <dc:creator>KimberlyGarbade</dc:creator>
    <dc:date>2022-05-05T15:58:20Z</dc:date>
    <item>
      <title>Python - CalculateField using CodeBlock contained in another Python Script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-calculatefield-using-codeblock-contained-in/m-p/1171122#M54797</link>
      <description>&lt;P&gt;I have a python script that corrects ALL CAPS into sentence case (Lets call it "SentCase.py" in this example) and includes a list of exceptions specific to my local area (I.E. "NAS THISCITY" becomes "NAS Thiscity" and not "Nas thiscity", etc).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to call SentCase.py from another python script that will step through 20+ feature classes and use SentCase to correct a "Notes" field in each.&lt;/P&gt;&lt;P&gt;What I have is some form of this, but (as you might have guessed already) it fails.&amp;nbsp; The message I receive is "NameError: name 'subsmade' is not defined".&lt;/P&gt;&lt;LI-CODE lang="c"&gt;arcpy.env.workspace = CGIntegrationsde
featClasses = arcpy.ListFeatureClasses('*Spatial*ET','','')
for fc in featClasses:
    arcpy.management.CalculateField(fc,'Notes','subsmade(!Notes!)','PYTHON3', 'import SentCase.subsmade')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SentCase.py is in the same directory as the called python script and I have tried to import SentCase into the calling script.&amp;nbsp; Also "subsmade" is a function in SentCase.py. It is the only function in SentCase.py as a matter of fact.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KimGarbade_0-1651765268422.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/40683i77B112B9ACC8376A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KimGarbade_0-1651765268422.png" alt="KimGarbade_0-1651765268422.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;K&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 15:41:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-calculatefield-using-codeblock-contained-in/m-p/1171122#M54797</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-05-05T15:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Python - CalculateField using CodeBlock contained in another Python Script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-calculatefield-using-codeblock-contained-in/m-p/1171139#M54802</link>
      <description>&lt;P&gt;Sorry for the short lived post, but I solved it....&lt;/P&gt;&lt;P&gt;I was using incorrect syntax.&amp;nbsp; The syntax should have been:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;arcpy.management.CalculateField(fc,'Notes','SentenceCase.subsmade(!Notes!)','PYTHON3', 'import SentenceCase')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 15:58:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-calculatefield-using-codeblock-contained-in/m-p/1171139#M54802</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-05-05T15:58:20Z</dc:date>
    </item>
  </channel>
</rss>

