<?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: Function in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/function/m-p/1046271#M60760</link>
    <description>&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Apr 2021 16:23:12 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-04-13T16:23:12Z</dc:date>
    <item>
      <title>Function</title>
      <link>https://community.esri.com/t5/python-questions/function/m-p/1046243#M60755</link>
      <description>&lt;P&gt;I am currently testing a function. Could you tell me how to make it works and how to use it as a module in another script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 09:07:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function/m-p/1046243#M60755</guid>
      <dc:creator>Mick</dc:creator>
      <dc:date>2021-04-18T09:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: Function</title>
      <link>https://community.esri.com/t5/python-questions/function/m-p/1046267#M60757</link>
      <description>&lt;P&gt;....&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 16:23:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function/m-p/1046267#M60757</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-04-13T16:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Function</title>
      <link>https://community.esri.com/t5/python-questions/function/m-p/1046269#M60759</link>
      <description>&lt;P&gt;Yes, I have an error "Could not complete". I have checked the list works when I use it not in the module and give a pathway. I guess something wrong with "return" or somewhere where I call the list.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 07:47:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function/m-p/1046269#M60759</guid>
      <dc:creator>Mick</dc:creator>
      <dc:date>2021-04-13T07:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: Function</title>
      <link>https://community.esri.com/t5/python-questions/function/m-p/1046271#M60760</link>
      <description>&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 16:23:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function/m-p/1046271#M60760</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-04-13T16:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: Function</title>
      <link>https://community.esri.com/t5/python-questions/function/m-p/1046276#M60761</link>
      <description>&lt;P&gt;Yes, arcmap. I did but had the same error message.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I only would like to check and print the list.&amp;nbsp; I need a workable solution.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 08:09:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function/m-p/1046276#M60761</guid>
      <dc:creator>Mick</dc:creator>
      <dc:date>2021-04-13T08:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Function</title>
      <link>https://community.esri.com/t5/python-questions/function/m-p/1046277#M60762</link>
      <description>&lt;P&gt;..&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 16:22:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function/m-p/1046277#M60762</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-04-13T16:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Function</title>
      <link>https://community.esri.com/t5/python-questions/function/m-p/1046279#M60763</link>
      <description>&lt;P&gt;I would like to use 'try 'and 'except' and check the module. Could you show how I can call this module from another script? The main reason is to use it as a module.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 08:33:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function/m-p/1046279#M60763</guid>
      <dc:creator>Mick</dc:creator>
      <dc:date>2021-04-13T08:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Function</title>
      <link>https://community.esri.com/t5/python-questions/function/m-p/1046299#M60764</link>
      <description>&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 16:24:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function/m-p/1046299#M60764</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-04-13T16:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Function</title>
      <link>https://community.esri.com/t5/python-questions/function/m-p/1046303#M60765</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 09:07:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function/m-p/1046303#M60765</guid>
      <dc:creator>Mick</dc:creator>
      <dc:date>2021-04-18T09:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Function</title>
      <link>https://community.esri.com/t5/python-questions/function/m-p/1046325#M60766</link>
      <description>&lt;P&gt;Note that mylist doesn't exist in the external script that you are importing and your IDE should have warned you.&amp;nbsp; Since you used the "import &lt;EM&gt;package"&lt;/EM&gt; method, &lt;EM&gt;mylist()&lt;/EM&gt; should be fully qualified &lt;EM&gt;(package.method) Names_Functions.Names_My&lt;/EM&gt;() when used. &lt;EM&gt;Names_My&lt;/EM&gt; does exist, and is the name of the function in the imported script.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import Names_Functions
my = Names_Functions.Names_My(filePath)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you used the "from &lt;EM&gt;package&lt;/EM&gt; import &lt;EM&gt;method"&lt;/EM&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from Names_Functions import Names_My&lt;/LI-CODE&gt;&lt;P&gt;you can just use the name of the function:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;my = Names_My(filePath)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to rename the imported module you can do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from Names_Functions import Names_My as mylist

my = mylist(filePath)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are tons of examples on how to use the try/except. A good place to start is the &lt;A href="https://docs.python.org/3/tutorial/errors.html#handling-exceptions" target="_self"&gt;python docs&lt;/A&gt; or &lt;A href="https://www.w3schools.com/python/python_try_except.asp" target="_self"&gt;w3&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 13:12:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function/m-p/1046325#M60766</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-04-13T13:12:57Z</dc:date>
    </item>
  </channel>
</rss>

