Render template from Module in twig template I have been searching around SE and the web in general for an answer to this. There seems to be plenty of solutions but none appear to be working for me.

I have a simple module that has a variable that gets called from a twig template in order to render a form.

The problem is no matter what I do I cannot get the module to render the HTML from within its own /templates directory.

The variable code is: 

$oldMode = \Craft::$app-&gt;view-&gt;getTemplateMode();
\Craft::$app-&gt;view-&gt;setTemplateMode(View::TEMPLATE_MODE_SITE);
$html = \Craft::$app-&gt;view-&gt;renderTemplate('../templates/_journey-planner.html');
\Craft::$app-&gt;view-&gt;setTemplateMode($oldMode);
return $html;


This is taken from the Craft docs. I have also used:

Event::on(View::class,
          View::EVENT_REGISTER_SITE_TEMPLATE_ROOTS,
          function (RegisterTemplateRootsEvent $e) {
                $e-&gt;roots['journeyplannermodule'] = 'journeyplannermodule/src/templates';
            }
        );


Within the module's init() function (not sure if this is actually required or not).

What am I doing wrong and what do I need to do to simply display this template within the twig template? 

I am calling the variable method with:
{{ craft.journeyPlannerModule.getJourneyPlanner }} 

Craft Version: 3.2.0
Now working. Turned out to be user error on my part. I had neglected the alias that I had created so the path to the template directory was incorrect.