I have a Drush script that I am running from my Drupal environment which loads a particular module that I want to get access to. Particularly, I want to use one of the functions it has defined in one of it's included files.

I tried just calling the function in my script, but PHP fails with an error citing an undefined function.

I am running the script as follow:

drush php-script ~/path/to/script.php

And this is my script in its entirety right now:

    $val = biblio_get_contributor(1);


biblio_get_contributor($aid) is most definitely defined in the module.

So to sum up, I need to get this module's functions loaded somehow. Thoughts?

  • I assume this module is enabled? Does drush php-eval 'print_r(biblio_get_contributor(1));' also fail?
    – mpdonadio
    Jul 16, 2012 at 14:48
  • It is enabled. Also yes, that command fails with the same error: called to undefined function. The module is most certainly enabled though, as it's live in my dev environment. Jul 16, 2012 at 14:50

1 Answer 1


The biblio_get_contributor() function is located in the includes/biblio.contributes.inc file. The file isn't automatically included by the module unless it needs it, which is probably why you're getting that error.

You can include it into a page build explicitly with the following:

module_load_include('inc', 'biblio', 'includes/biblio.contributors');
  • 1
    Right on. You're the man Clive. Jul 16, 2012 at 14:59

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.