Implementing preprocess function for custom template In Drupal 7, I'm creating thank you page for a custom form and have following in my mymodule.module:

function mymodule_menu() {
  $items = array();

  $items['mymodule/thank_you/%'] = array(
    'title' =&gt; 'My Module Thank You Page',
    'description' =&gt; 'my module thank you page',
    'page callback' =&gt; 'mymodule_thank_you_page',
    'access arguments' =&gt; array( 'access mymodule thank you page' ),
    'type' =&gt; MENU_NORMAL_ITEM,
  );

  return $items;
}

function mymodule_theme() {
  return array(
    'mymodule_thank_you' =&gt; array(
      'variables' =&gt; array(
          'form_id' =&gt; NULL,
          'content' =&gt; NULL,
          'title' =&gt; NULL,
      ),
      'template' =&gt; 'thank-you',
      'file' =&gt; 'mymodule.theme.inc',
      'path' =&gt; drupal_get_path('module', 'mymodule') . '/templates',
    ),
  );
}

function mymodule_thank_you_page() {
  drupal_set_title( t( 'Thank You.' ) );

  $variables = array();

  return theme( 'mymodule_thank_you', $variables );
}


In mymodule.theme.inc, I have:

function template_preprocess_mymodule_thank_you( &amp;$variables ) {
  $variables['title'] = 'test';
}


The problem I'm facing is that while I can access the thank-you template correctly, it doesn't read any of the variables I define in the preprocess function in the theme.inc file. Can anyone advice what I'm doing wrong for this?
I tried your thing on my local server. And its working fine. Just try in your template:

&lt;?php
  // Print your defined variable here like this.
  print $title;
?&gt;