Symfony how to include controller on base.html.twig

I have a small question, I’m new to symfony, I created a controller and a menu template that I want to integrate into my base.html.twig.

I absolutely need the controller to be called because I am testing to know if the session variable is empty or not.

    {% block menu %}
    {% include 'menu/index.html.twig' %}
    {% endblock %}
    
    <body>
        {% block body %}{% endblock %}
    </body>

So I tried this (it works perfectly BUT it didn’t call my controller so when I do my test on session it won’t work….)

I searched but I can’t include the controller instead of the template…

thanks in advance