g is a global namespace that can be used to store any data during a single app context. A before request handler, for example, may set g.user, which the route and other functions will have access to. In the flask, on the other hand, a session object, which is a dictionary object that holds a key-value pair of the session variables and their associated values, is used to track the session data. To set the session variable to a specified value on the server, use the following syntax. We can use the session to save data for a specific browser. When a user of our Flask app makes more queries while using the same browser, the session data is carried over.