Drush command can't find Drupal module function 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?
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