How to tell Drupal to use tpl file from my module? I have a custom module and placed comment.tpl.php here:

/sites/all/modules/mymodule/comment.tpl.php

But Drupal is not looking for that file in my custom module directory. How can i make it work?
You need to use hook_theme:

/**
 * Implements hook_theme().
 */
function MY_MODULE_theme($existing, $type, $theme, $path) {

  if($type != 'module') {
    return [];
  }

  // If you want to put your templates in a templates directory
  // in your module directory add .'/templates' to the end.
  $module_path = drupal_get_path('module', 'MY_MODULE');

  return [
    'comment' =&gt; [
      'template' =&gt; 'comment',
      'path'     =&gt; $module_path,
    ],
    'other_template' =&gt; [
      'template' =&gt; 'comment',
      'path'    =&gt; '/my/custom/path/here',
    ],
  ];
}


This has set up our custom theme, then when you want to use it you can:

$tpl_data = [
  'param1' =&gt; $foo,
  'param2' =&gt; $bar,
];

return theme('comment', $tpl_data);


Now $param1 and $param2 will be available in your template file too.

If you don't need any custom data in your template then $tpl_data can be omitted.

Happy days.