How to determine module path in drush which is outside of Drupal root? I've downloaded Coder (7.x-2.x) module in the following way:

drush -y dl coder-7.x-2.x --destination=~/.drush &amp;&amp; drush cc drush


And I would like to call function (coder_review_reviews()) from drush (using eval) which is defined in ~/.drush/coder/coder_review/coder_review.common.inc and I need to include that file first, but I don't know how to determine my module path.

Normally when module is within Drupal root, you can use module_load_include() for that, but this function is not available when you're calling drush outside of your core. It seems I can't use dd either.

How can I achieve that without hardcoding the path to the module?
In Drush, the right way to do this is to use drush_invoke_process() to call a Drush function in coder that calls coder_review_reviews() for you, and returns the result as the function result of the Drush command implementation.  I did not check to see if coder does this.

If the service you need is not exported, the alternative is to call drush_get_commandfiles().  The result you will get is a key / value pair, where the key 'coder' has the value of the full path to the coder.drush.inc file.

When commands do not export the functionality you need, it is better to submit a patch on their project providing the access you need. Directly including .inc files and calling internal functions is fragile, and at risk of breaking in new versions of the project.