Custom form template
Adding the response I gave on Drupal.org:

The issue is that you are rendering the form with the theme() function, in the form definition. Instead, you need to identify the form as using a #theme, and let it be rendered downstream:

So remove this:

$form = theme('atavism_license_list_view', array('form' =&gt; $form));


And add this:

$form['#theme'] = 'atavism_license_list_view';


Link: https://www.drupal.org/forum/support/module-development-and-code-questions/2019-03-07/custom-template-file-for-modules#comment-13019068