check if user log in flask

from flask_login import current_user

def your_route():
    return current_user.is_authenticated

Here is what the above code is Doing:
1. Importing the current_user object from flask_login.
2. Creating a route that returns the value of current_user.is_authenticated.
3. If you’re using the @login_required decorator, you can access the current_user object from anywhere in your code.