I created sample command in Drush.

I put it to sites/all/drush.

I am on my site root and calling this command works ok. But when I try to call any Drupal function in drush_MY_COMMAND function I am getting:

Error: Call to undefined function

Could someone give me any hint how to solve this issue?

1 Answer 1


It sounds like your site is not being selected. Try calling your command with your cwd in the same folder as your settings.php file (e.g. cd sites/default); that should work. You may also create an alias for your site, and call your command from any directory via drush @site mycommand

  • I go to default directory and launch command: drush --include=../all/drush jbip-migrate and I am getting about not found of node_load() function still :/
    – Codium
    Aug 10, 2012 at 17:03
  • Anyway great thanks for help I try to resolve this later by creating site alias
    – Codium
    Aug 10, 2012 at 17:24
  • If you are still having trouble, you may also post an issue in the Drush queue at drupal.org/node/add/project-issue/drush. Please follow the instructions at the top (e.g. provide output of drush status and --debug output of your command). Aug 11, 2012 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.