Hi, I'm trying to run some PHP as an action. I am a little fuzzy about what Drupal API call I can make there. I am trying to invoke functions from another module. So I was thinking I need to load that module first, like:

module_load_include('module', 'commerce_payment');
module_load_include('module', 'commerce_moodle');

Is this the right way? Or are all Drupal modules already loaded, present? I will be trying to pass some parameters into these functions, hopefully.

Thanks for guidance.

Comments

goose2000 created an issue. See original summary.

TR’s picture

Status: Active » Fixed

Enabled .module files are automatically loaded by Drupal when Drupal bootstraps, but .inc files are only loaded when demanded. So yes, use module_load_include() if the function you're trying to call isn't found. Generally, however, functions that are part of a module's API should be in the .module file.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.