Drupal 8 – Custom Module template


I tried to have a custom template for my page. I have tried a lot’s of solution, but it’s not working with my templates within the module.

From my_module.module I have

function my_module_theme($existing, $type, $theme, $path) {
    return array(
        'events_listing_display' => array(
            'variables' => array(
                'events' => NULL,
            'template' => 'events-listing-list',

From my controller I have

        $events = 'test';
        return [
            '#theme' => 'events_listing_display',
            '#events' => $events,

and the events-listing-list.html.twig is in my_project/modules/custom/my_module/templates/

the error message I have is
Twig_Error_Loader: Template "themes/My_Theme/templates/events-listing-list.html.twig" is not defined (DrupalCoreTemplateLoaderThemeRegistryLoader: Unable to find template "themes/My_Theme/templates/events-listing-list.html.twig" in the Drupal theme registry.). in Twig_Loader_Chain->getCacheKey() (line 115 of /var/www/my_project/vendor/twig/twig/lib/Twig/Loader/Chain.php).

I have clear the cached with drush cc and drush cc theme-registry.

It’s working if I put the template file in the theme directory, but this is not what I want (there is no file in the theme directory when I tried to debug).

I do not understand what’s wrong.

If anyone have an idea, it will be well appreciated!

Drupal version: 

Source: https://www.drupal.org/taxonomy/term/4/feed