Include a module template into an other module template I'm working on a Drupal 8 project and in my module X twig template I need to include the template of an other module Y. All what I found in documentation is how to call a template inside other template in theme see here

I've tried in my twig-of-module-X.html.twig file:

{% include 'modules/Y/templates/twig-of-module-Y.html.twig' %}


but doesn't work!
Any suggestion please?
Include the template file with its namespace:

{% include '@modulename/template_file.html.twig' %}

{# @modulename refers to 'path_to_module/templates' #}

Drupal provides a @namespace for Twig based on the machine name of every module and every theme. The @namespace points to the templates sub-directory of that module or theme.