Including Part Template within a Custom Module I am writing a custom module that uses several twig templates in my modules /templates directory. I want to use part templates (https://www.drupal.org/node/2634166) so that I could reference the following:

{% include directory ~ 'includes/spr_table_selectors.twig' %}


The problem is my include keeps referencing my main site theme (themes/mytheme/...). Is there an easy way I can reference my includes directory within my custom module?
There should be a change to the theming documentation in this case. Namespace for twig is always set to MYTHEME/templates or MYMODULE/templates.

The directory variable is to ACTIVETHEME/templates.

So if you look at how the Symphony folks have been do things, you will find out they have their template parts in a subdirectory named parts rather then a sibling directory named includes. Use the subdirectory will fixed your problem. BONUS you can use @ to call the namespace of your module or theme like this:

&lt;header&gt;
  {% include '@MYMODULE/parts/header.html.twig' %}
&lt;/header&gt;


Remember to keep your template part name(s) unique from the templates in use by your Drupal install to avoid them being used as a full template item that overrides something provided by core or another module.