<?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 How do we import a script that defines a function using arcpy without a NameError? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178975#M13742</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to run a script called update_parcels.py in the Arcmap python window (version 10.4) that imports another script in the same directory that defines field mappings (it has a single def statement). My understanding is that both scripts should import arcpy, because both are using arcpy functions (field map objects and management geoprocessing methods), but running the first script results in an error: "NameError: global name 'arcpy' is not defined," as it imports the second script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should just 1 script import arcpy? Should I set PYTHONPATH in the OS (Windows 10)? What kinds of things should I be looking at to be able to use the function definition in the second script in my first ("main") script? Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Jul 2017 00:08:04 GMT</pubDate>
    <dc:creator>MichaelMorgan4</dc:creator>
    <dc:date>2017-07-28T00:08:04Z</dc:date>
    <item>
      <title>How do we import a script that defines a function using arcpy without a NameError?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178975#M13742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to run a script called update_parcels.py in the Arcmap python window (version 10.4) that imports another script in the same directory that defines field mappings (it has a single def statement). My understanding is that both scripts should import arcpy, because both are using arcpy functions (field map objects and management geoprocessing methods), but running the first script results in an error: "NameError: global name 'arcpy' is not defined," as it imports the second script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should just 1 script import arcpy? Should I set PYTHONPATH in the OS (Windows 10)? What kinds of things should I be looking at to be able to use the function definition in the second script in my first ("main") script? Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jul 2017 00:08:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178975#M13742</guid>
      <dc:creator>MichaelMorgan4</dc:creator>
      <dc:date>2017-07-28T00:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do we import a script that defines a function using arcpy without a NameError?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178976#M13743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try not importing arcpy in either of them.&lt;/P&gt;&lt;P&gt;It is not required when running in the ArcMap python window.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jul 2017 14:33:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178976#M13743</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2017-07-28T14:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do we import a script that defines a function using arcpy without a NameError?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178977#M13744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How exactly are you importing this files, and what do the import statements look like in each file.&amp;nbsp; I don't have a problem importing a file that references arcpy along with another file/module that also imports arcpy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jul 2017 14:50:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178977#M13744</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-07-28T14:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do we import a script that defines a function using arcpy without a NameError?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178978#M13745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My main script is using TruncateTable_management and Append_management, which are both methods coming directly out of arcpy, so the main script needs to import. I am now trying to run the secondary (def function) script first in the Arc Python window, also with arcpy to get FieldMapping() and FieldMap() objects, to see if this just retains the function definition in this Arc session.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jul 2017 17:29:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178978#M13745</guid>
      <dc:creator>MichaelMorgan4</dc:creator>
      <dc:date>2017-07-28T17:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do we import a script that defines a function using arcpy without a NameError?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178979#M13746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You said you are running in the "ArcMap" python window.&amp;nbsp; Arcpy is automatically "imported" into that, so no need to import it again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Typing/entering "import arcpy" into the ArcMap python window has absolutely no affect at all, so why bother, especially if it is giving you problems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jul 2017 17:45:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178979#M13746</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2017-07-28T17:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do we import a script that defines a function using arcpy without a NameError?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178980#M13747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks like I can get around this problem by loading the def function script first (importing arcpy for field map objects), and then loading the main script, also importing arcpy but not importing the secondary script. Thanks all.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jul 2017 17:47:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178980#M13747</guid>
      <dc:creator>MichaelMorgan4</dc:creator>
      <dc:date>2017-07-28T17:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do we import a script that defines a function using arcpy without a NameError?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178981#M13748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a reason you need to import the def function.&amp;nbsp; You can&amp;nbsp;just copy/paste it into the main script unless the import is needed for something else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jul 2017 17:55:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178981#M13748</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2017-07-28T17:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do we import a script that defines a function using arcpy without a NameError?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178982#M13749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Really just to understand how this process works, but also because the def function should stand alone and be able to be called from other scripts as needed. This is my first script that needs to call a function, but it is probably not my last. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2017 17:39:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178982#M13749</guid>
      <dc:creator>MichaelMorgan4</dc:creator>
      <dc:date>2017-08-07T17:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do we import a script that defines a function using arcpy without a NameError?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178983#M13750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Going back to my first comment:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;How exactly are you importing this files, and what do the import statements look like in each file.&amp;nbsp; I don't have a problem importing a file that references arcpy along with another file/module that also imports arcpy.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If you haven't already, I suggest you read &lt;A class="link-titled" href="https://docs.python.org/2/tutorial/modules.html" title="https://docs.python.org/2/tutorial/modules.html"&gt;6. Modules — Python 2.7.13 documentation&lt;/A&gt;&amp;nbsp; , it has lots of helpful information on importing modules, which is really what you need to focus on since your function lives within a module.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2017 17:47:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178983#M13750</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-08-07T17:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do we import a script that defines a function using arcpy without a NameError?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178984#M13751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;a cheesie example... but you will get the drift I hope&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# -*- coding: UTF-8 -*-&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;"""
Script: main_script.py
Requires: amazorama.py

"""&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; amazorama &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; amaze

a &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"some string that I am going to use a function"&lt;/SPAN&gt;
b &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; amaze&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;some_func&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;a&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"From beyond...{}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;b&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# ----------------- save the above code as main_script.py --------------&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# ----------------- save the below code as amazorama.py ----------------&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# now, save both in the same folder, and load, check and run main_script&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# -*- coding: UTF-8 -*-&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;"""
amazorama.py

imported by main_script.py
"""&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Just visiting while I import the functions from this script"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Arcpy is located in {}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;__file__&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;


&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;some_func&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;a&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;"""does stuff"""&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; a &lt;SPAN class="keyword token"&gt;is&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;a&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;upper&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;a&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;upper&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;results&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;runfile&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'C:/Temp/main_script.py'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; wdir&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'C:/Temp'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

Just visiting &lt;SPAN class="keyword token"&gt;while&lt;/SPAN&gt; I &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; the functions &lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; this script
Arcpy &lt;SPAN class="keyword token"&gt;is&lt;/SPAN&gt; located &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; C&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;\ArcPro\Resources\ArcPy\arcpy\__init__&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;py
From beyond&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SOME STRING THAT I AM GOING TO USE A FUNCTION&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:10:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178984#M13751</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T09:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do we import a script that defines a function using arcpy without a NameError?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178985#M13752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By chance are you importing arcpy in a executable context like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; __name__ &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'__main__'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp; &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Its a commonly suggested idiom to be able to run scripts from the command prompt, however it causes problems if run from within ArcGIS since 'arcpy' won't be defined in namespaces outside of the conditional. Its a shot in the dark but seems possible here.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:10:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-we-import-a-script-that-defines-a-function/m-p/178985#M13752</guid>
      <dc:creator>ClintonDow1</dc:creator>
      <dc:date>2021-12-11T09:10:08Z</dc:date>
    </item>
  </channel>
</rss>

