title: Python Flask returning a html page while simultaneously performing a function
body: <p>I'm currently creating a web app using Python Flask and I've run into a road block and I'm not sure if I'm even thinking about it correctly.</p>
  
  <p>So my website's homepage is just a simple landing page with text input that is required to perform the websites function. What I am trying to accomplish is for the web app to perform two things after the text is input. First, the server takes the username input and performs a function that doesn't return anything to the user but creates a bunch of data that is logged into an sqlite database, and used later on in the process. Then, the server returns the web page for a survey that has to be taken after the username is input. However, the function that the server performs can take upwards of 2 minutes depending on the user. The way I currently have it coded, the server performs the function, then once it has finished, it returns the web page, so the user is stuck at a loading screen for up to 2 minutes. </p>
  
  <pre><code>@app.route("/survey")
  def main(raw_user):
      raw_user = request.args.get("SteamID")      &lt;
      games = createGameDict(user_obj)            &lt;----- the function
      tag_lst = get_tags(games)                   &lt;
      return render_template("survey_page.html")
  </code></pre>
  
  <p>Since the survey doesn't depend on the user input, instead of having the user sitting at a loading screen, I would like them to be able to start the survey while the functions works in the background, is that possible, and how would I do that?</p>