title: AWS Python Lambda with multiple functions
body: <p>I have an AWS Lambda function in python3.7. The way its set up im running the <code>lambda_handler(event, context)</code> function and passing data to a separate function that calls itself multiple times depending on what is passed into it. How do I then return data from the second function?</p>
  
  <pre><code>import json
  import boto3
  
  def lambda_handler(event, context):
      # code to get initial data
      x = second_function(data)
      print(x)
      return x
  
  
  
  def second_function(data):
      # code to manipulate data
      if condition:
         print(newData)
         second_function(newData)
      else:
         return allData
  </code></pre>
  
  <p>I expected this to return allData back through the <code>lambda_handler</code> function, but instead returns null</p>
  
  <p>And logged is </p>
  
  <pre><code>newData
  newData
  newData
  None
  </code></pre>
  
  <p>I am using the second function to get data based on the last <code>PaginationToken</code>. Is there a better way to get paginated data rather than creating a second recursive function?</p>