'Returning a functions output inside flask

I would like to return the output of a function called to start inside my flask render profile function.

The code explains better than I do:

# Creates the profile page for users, the users are required to be logged in to view this page
@main.route('/profile')
@login_required
def profile():
    output = getpass()
    #this function returns 13, 17, 22 and 25 
    if getpass() != None:
        print("output")
        return render_template('profile.html', name=current_user.name, email=current_user.email, id=output)
    else:
        print("nothing here"
        return render_template('profile.html', name=current_user.name)
{% if id is defined %}
<h1>
  {% for i in id %}
    Your ID are: {{ id }}
  {% endfor %}
</h1>
{% endif %}

The website however does not show anything and unfortunately it prints nothing here in the terminal. How do I return the output from the function properly to make website show the IDs?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source