<?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 with two return values in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048043#M60810</link>
    <description>&lt;P&gt;Hi Mick,&lt;/P&gt;&lt;P&gt;The getPerson function does not take any parameters, yet you are passing the variable "filePath" into it. In other words, "filePath" has no local variable to be mapped to within the function.&lt;/P&gt;&lt;P&gt;Also, is getPerson a class method? If not, it's being invoked incorrectly. Try this out:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;def getPerson():
    name = "Leona"
    age = 35
    country = "UK"
    return name,age,country&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;import arcpy, getPerson

filePath = "C:/1.gdb"

name, age, county = getPerson()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Josh&lt;/P&gt;</description>
    <pubDate>Fri, 16 Apr 2021 12:05:59 GMT</pubDate>
    <dc:creator>GeoJosh</dc:creator>
    <dc:date>2021-04-16T12:05:59Z</dc:date>
    <item>
      <title>Function with two return values</title>
      <link>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048036#M60809</link>
      <description>&lt;P&gt;Good day, everybody.&lt;/P&gt;&lt;P&gt;I have a function with several return values that I would like to call from another script. However, it does not work. Could you explain how to call the function in the right way? The &lt;STRONG&gt;first example is a little bit wrong.&lt;/STRONG&gt; The main idea to set the pathway and work with three values in my another script. However, it works only with the first one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def getPerson(fileFolder):
    #Import arcpy module
    import arcpy

    from arcpy import env
    

      
     #Set workspace
     env.workspace = fileFolder
     name = .....
     age = .....
     country = .....
     return name, age, country&lt;/LI-CODE&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;LI-CODE lang="python"&gt;import arcpy, getPerson

filePath = "C:/1.gdb"

name, age, county = getPerson.getPerson(filePath)&lt;/LI-CODE&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>Fri, 16 Apr 2021 12:18:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048036#M60809</guid>
      <dc:creator>Mick</dc:creator>
      <dc:date>2021-04-16T12:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Function with two return values</title>
      <link>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048043#M60810</link>
      <description>&lt;P&gt;Hi Mick,&lt;/P&gt;&lt;P&gt;The getPerson function does not take any parameters, yet you are passing the variable "filePath" into it. In other words, "filePath" has no local variable to be mapped to within the function.&lt;/P&gt;&lt;P&gt;Also, is getPerson a class method? If not, it's being invoked incorrectly. Try this out:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;def getPerson():
    name = "Leona"
    age = 35
    country = "UK"
    return name,age,country&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;import arcpy, getPerson

filePath = "C:/1.gdb"

name, age, county = getPerson()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Josh&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 12:05:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048043#M60810</guid>
      <dc:creator>GeoJosh</dc:creator>
      <dc:date>2021-04-16T12:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Function with two return values</title>
      <link>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048050#M60811</link>
      <description>&lt;P&gt;No, I want to set the pathway. A better example is given.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 12:20:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048050#M60811</guid>
      <dc:creator>Mick</dc:creator>
      <dc:date>2021-04-16T12:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Function with two return values</title>
      <link>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048054#M60812</link>
      <description>&lt;P&gt;Don't edit your original thread.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have made 3 edits according to your editing history, making it hard for people to assess people's responses to your questions.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/340924"&gt;@GeoJosh&lt;/a&gt;&amp;nbsp;'s response was correct to your original question.&lt;/P&gt;&lt;P&gt;Post updated code in your responses&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 12:30:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048054#M60812</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-04-16T12:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: Function with two return values</title>
      <link>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048065#M60813</link>
      <description>&lt;P&gt;Okay, the second part of my response still stand true. Given your current code sample, it looks like you are calling a class function (class.function(parameters)) but the function definition shows no sign of being a class method. Try invoking the function like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import arcpy, getPerson

filePath = "C:/1.gdb"
name, age, county = getPerson(filePath)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 12:48:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048065#M60813</guid>
      <dc:creator>GeoJosh</dc:creator>
      <dc:date>2021-04-16T12:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Function with two return values</title>
      <link>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048066#M60814</link>
      <description>&lt;P&gt;I have error "TypeError: 'module' object is not callable"&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 12:50:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048066#M60814</guid>
      <dc:creator>Mick</dc:creator>
      <dc:date>2021-04-16T12:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Function with two return values</title>
      <link>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048069#M60815</link>
      <description>&lt;P&gt;Your import statement may be incorrect. Replace &amp;lt;pythonfile&amp;gt; with the name of the Python file that contains the getPerson function.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import arcpy
from &amp;lt;pythonfile&amp;gt; import getPerson

filePath = "C:/1.gdb"
name, age, county = getPerson(filePath)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 16 Apr 2021 12:53:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048069#M60815</guid>
      <dc:creator>GeoJosh</dc:creator>
      <dc:date>2021-04-16T12:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Function with two return values</title>
      <link>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048073#M60816</link>
      <description>&lt;P&gt;It works but gives only the first value&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 12:58:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048073#M60816</guid>
      <dc:creator>Mick</dc:creator>
      <dc:date>2021-04-16T12:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: Function with two return values</title>
      <link>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048075#M60817</link>
      <description>&lt;P&gt;To troubleshoot further you will need to attach both Python files to a reply to this message.&lt;/P&gt;&lt;P&gt;Thank you,&lt;BR /&gt;Josh&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 13:00:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048075#M60817</guid>
      <dc:creator>GeoJosh</dc:creator>
      <dc:date>2021-04-16T13:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Function with two return values</title>
      <link>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048078#M60818</link>
      <description>&lt;P&gt;Okay, I have found the issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Josh&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 13:16:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/function-with-two-return-values/m-p/1048078#M60818</guid>
      <dc:creator>Mick</dc:creator>
      <dc:date>2021-04-16T13:16:29Z</dc:date>
    </item>
  </channel>
</rss>

