If your module (the caller) lists the module that you are calling (the callee) as a dependency in its description.yaml file (see Reference of properties in a Module's description.yaml file) then the caller can call the callee's methods in its php code:
class caller_module extends module_base_class {
public function showSlot() {
callee_module:doSomething();
}
}
If the caller does not have the callee listed as a dependancy, the caller must first use the inc() function to try and include the callee:
class caller_module extends module_base_class {
public function showSlot() {
if (inc('callee_module')) {
callee_module:doSomething();
} else {
//Do something else...
}
}
}
The caller should only try to call the callee if the inc() function returned true.