Python - CalculateField using CodeBlock contained in another Python Script

05-05-2022 08:41 AM
Labels (1)
Occasional Contributor III

I have a python script that corrects ALL CAPS into sentence case (Lets call it "" 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).  

I want to call from another python script that will step through 20+ feature classes and use SentCase to correct a "Notes" field in each.

What I have is some form of this, but (as you might have guessed already) it fails.  The message I receive is "NameError: name 'subsmade' is not defined".

arcpy.env.workspace = CGIntegrationsde
featClasses = arcpy.ListFeatureClasses('*Spatial*ET','','')
for fc in featClasses:,'Notes','subsmade(!Notes!)','PYTHON3', 'import SentCase.subsmade') is in the same directory as the called python script and I have tried to import SentCase into the calling script.  Also "subsmade" is a function in It is the only function in as a matter of fact.


Any help would be appreciated.


0 Kudos
1 Reply
Occasional Contributor III

Sorry for the short lived post, but I solved it....

I was using incorrect syntax.  The syntax should have been:,'Notes','SentenceCase.subsmade(!Notes!)','PYTHON3', 'import SentenceCase')


0 Kudos