title: Flask session variables cannot be retrieved for various actions on google
body: <p>I am using Dialogflow to receive user input and the received values are passed to the flask program using a webhook call. Session variables are set for this action on webhook call. For another google action, I am trying to retrieve the session variables. But, I am not able to access them. Let me know where I am going wrong. Thanks in advance.</p>
  <p>DialogFlow Intent - setclass
  Receives the parameter 'class' (grade) from the User and invokes the Action setclass, which sets the session variables class and grade through webhook call.</p>
  <p>Dialogflow Intent - getclass
  Action getclass gets the values set in the session through webhook call.</p>
  <p>Flask program to store and receive values from session:</p>
  <pre><code>from flask import Flask, request, session, jsonify
  
  app = Flask(__name__)
  app.secret_key = &quot;abc&quot;
  
  @app.route(&quot;/sessiontrial&quot;,methods=['POST','GET'])
  def sessiontrial():
      req = request.get_json(silent=True, force=True)
      value = req.get('queryResult')
      params = value.get('parameters') 
      action = value.get('action')
      
      print(&quot;Inside sessiontrial&quot;)
  
      if (action == &quot;setclass&quot;):
          classno = params.get('class')
          print (classno)
          session['class'] = classno
          session['grade'] = str(classno) + &quot; Grade&quot;
          print (session['grade'])
          res = {&quot;fulfillmentText&quot;: classno}
          return(jsonify(res))
  
          
      if (action == &quot;getclass&quot;):      
          if 'class' in session:  
              classs = session['class']
              print(&quot;Class is: &quot;, classs)
              gradee = session['grade']
              print(&quot;Grade is: &quot;, gradee)
              res = {&quot;fulfillmentText&quot;: gradee}
              return(jsonify(res))
          else:
              print(&quot;Class not found in Session&quot;)    
              res = {&quot;fulfillmentText&quot;: &quot;Class not found in Session&quot;}
              return(jsonify(res))
  
  if __name__ == '__main__':
      app.run()
  </code></pre>