How to render a template from within a module? I'm currently developing a module that contains a custom field and I'd like to create a template to be used in the getInputHtml method.

I try using the Craft::$app-&gt;view-&gt;renderTemplate method to render a template in the "resources" folder of my module, but Craft does not seem to find the template. How should I specify the path to the template from this module?
You need to include your template roots Enhancing a Craft CMS 3 Website with a Custom Module

public function __construct($id, $parent = null, array $config = [])
{
    Craft::setAlias('@modules/sitemodule', $this-&gt;getBasePath());
    $this-&gt;controllerNamespace = 'modules\sitemodule\controllers';

    // Base template directory
    Event::on(View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $e) {
        if (is_dir($baseDir = $this-&gt;getBasePath().DIRECTORY_SEPARATOR.'templates')) {
            $e-&gt;roots[$this-&gt;id] = $baseDir;
        }
    });

    // Set this as the global instance of this module class
    static::setInstance($this);

    parent::__construct($id, $parent, $config);
}