I thought that when I do “Export Template”, the custom modules, installed on the exporting portal, will be exported as well.
But it is not the case.
The template has only page layout and references to module definitions that are located on the page.
To make imported template working, you need to import each custom module to the new portal first.
Alternatively new modules can be added to install folder to be installed as a part DNN install.