Modular name in twig

Please tell me how to get the name of a modular page template using twig? It is necessary to insert in the templates instead of the id.

You can find this twig variable using dump(). Open up modular.html.twig and add dump() like this:

{% for module in page.collection() %}
        {{ dump(module) }}

You need to enable the debugger in admin/config/system, then load your modular page and you’ll see the debugger bar along the bottom of the page. Click on messages, and you’ll see something like this for each modular subpage:

Grav\Common\Page\Page {#167 #name: ...

If you click on this you’ll see all the available twig variables for that subpage. One of them will be the template for that subpage.