Batch operation isn't called I have a module with batch operations, this is my hook_menu

$items['some-pretty-url'] = array(
    'title'            =&gt; 'Title',
    'page callback'    =&gt; 'drupal_get_form',
    'page arguments'   =&gt; array('import_form'),
    'access arguments' =&gt; array('access content'),
    'type'             =&gt; MENU_NORMAL_ITEM,
);


...and this is my batch config

$batch  = array(
    'title'            =&gt; t('Lorem ipsum Elit pariatur Duis et elit aute.'),
    'init_message'     =&gt; t('Commencing...'),
    'operations'       =&gt; $operations,
    'progress_message' =&gt; t('Processed: @current out of @total.'),
    'error_message'    =&gt; t('An error occurred during processing.'),
    'finished'         =&gt; '_import_finished',
);


Batch works pretty good if I have the module definition in the .module file, but if I move the functions to another file the batch simply does not work at all.

$items['some-pretty-url'] = array(
    'title'            =&gt; 'Title',
    'page callback'    =&gt; 'drupal_get_form',
    'page arguments'   =&gt; array('import_form'),
    'access arguments' =&gt; array('access content'),
    'type'             =&gt; MENU_NORMAL_ITEM,
    'file'             =&gt; 'module_definition.inc', //move module to another file
);

$batch  = array(
    'title'            =&gt; t('Lorem ipsum Elit pariatur Duis et elit aute.'),
    'init_message'     =&gt; t('Commencing...'),
    'operations'       =&gt; $operations,
    'progress_message' =&gt; t('Processed: @current out of @total.'),
    'error_message'    =&gt; t('An error occurred during processing.'),
    'finished'         =&gt; '_import_finished',
    'file'             =&gt; 'module_definition.inc', //batch functions are here
);


Batch function is not being called even if I set the file argument in the batch configuration.
When you run a batch the URL automatically changes to /batch...at that path, Drupal doesn't know to include your module_definition.inc file. It'll only process the menu hook when the path is 'some-pretty-url', so module_definition.inc will only be included then.

If you move your batch definition into the module file it'll start working, and the file you've told the batch system to find the processing function in will be included as you'd expect, because now Drupal knows it needs to be included.