How to render plugin templates in Craft CMS 3? I cannot find a way to render templates from a plugin controller in Craft 3. I feel as though I've tried every variation advised online but for some reason this still isn't working.

&lt;?php

namespace abc\members\controllers;

class LoginController extends \craft\web\Controller
{
    public function actionForm()
    {
        $this-&gt;renderTemplate('abc-members/login.html');
    }
}


The plugin handle is "abc-members".

The plugin has a "templates" directory with "login.html".

I've tried the following, with and without the .html extension, but none can find the template:

$this-&gt;renderTemplate('abc-members/login.html');
$this-&gt;renderTemplate('abc-members/templates/login.html');
$this-&gt;renderTemplate('abc-members/src/templates/login.html');
$this-&gt;renderTemplate('abc/members/src/templates/login.html');
$this-&gt;renderTemplate('plugins/abc/members/src/templates/login.html');


The following works fine but then I cannot include templates from the installation's main template directory.

&lt;?php

namespace abc\members\controllers;

class LoginController extends \craft\web\Controller
{
    public function actionForm()
    {
        \Craft::$app-&gt;view-&gt;setTemplatesPath(__DIR__ . '/../templates');
        $this-&gt;renderTemplate('login.html');
    }
}


Any suggestions as to where I'm going wrong? I find the Craft 3 docs are a bit lacking in the whole area of plugin controllers, routing and templates other than in the Craft 2 => Craft 3 upgrade guide.

Thanks
After becoming more familiar with Craft and Yii, I've found a more appropriate solution for my use case. I have a couple of ideal requirements:


Templates are stored in a directory within my module or plugin.
Templates can be mixed with general application templates (e.g. my module or plugin template can extend from a general site layout template).


It turns out that the Template Roots functionality enables this, so it is documented but for some reason I was overlooking this previously.

You can simply register the template root during plugin/module init like so:

Event::on(View::class, View::EVENT_REGISTER_SITE_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $event) {
   $event-&gt;roots['_my_prefix'] = __DIR__ . '/templates';
});


Then templates in the defined directory can be rendered using the defined prefix (_my_prefix in this case), as though that directory exists in the main templates directory. This means they can be used in any context and extend or include templates in the main directory ‒ desirable for app specific plugins/modules.