Look for documentation about how precisely modules parts are loaded (Drupal 7) Developping my custom module, I ran several times into misunderstood issues regarding the precise order used by Drupal when loading parts of a module.
Each time, I finally got rid of it after any disabled and suppressed then recreated, but this is obviously not satisfying.

So I'm now looking for sufficient information to be able to understand what happens in those circumstances.

This time the problem I have is as follows:


Having my module working fine on a site under D-7.34, I upgraded it to D-7.35, following all necessary steps.
After successfully executing update.php (which notified that no update was needed), I clicked to go to front page: this one was properly displayed.
NOTE: necessarily, my module was already involved at this stage, since it works during output rendering (so whatever the path indicated by the URL)
But from there, then, any attempt to access another page (either public or administrative one) fires a PHP error "Call to undefined function myfunction()...", where myfunction() belongs to my module.


I can't figure out how it is possible, since my code schematically looks like:

file: mymodule.module

&lt;?php

module_load_include('inc', 'mymodule', 'mymodule.core');

function mymodule_some_hook() {
    # ...
    myfunction();
    # ...
}


file: mymodule.core

&lt;?php

function myfunction() {
    # ...
}


In other words, in my eyes:


when the error fires, it necessarily means that mymodule.module was loaded, since it is where myfunction() call resides
then if mymodule.module was loaded, it should have first executed module_load_include(), so loading mymodule.core and defining myfunction()


Yet it is clear that, in this case, something is happening differently!

But why this behaviour now, and not at the first access to front page?
And why this behaviour with D-7.35 (where no changes seem to be involved here), and not with D-7.34?

NOTE: I suspected something wrong with caching, so I tried flushing it. But flushing process failed with the same "Call to undefined function".
Then I used directly PhpMyAdmin to truncate all cache tables, without success: behaves the same after that.

Comments greatly welcome, and notably if pointing to any documentation about detailed process of modules load.
Thanks in advance.
After a lot of tests, I'm now pretty convinced that, despite it is not mentioned in the release notes page, a change happened in 7.34, which consists in that, now, the full-bootstrap condition is not reached yet when the MODULE.module file is loaded.

According to module_load_include() page, this function requires Drupal to be fully bootstrapped: this clearly relies to the use of drupal_get_path() (see the function code in this page), which is not available without full-bootstrap.

It is why my (global-scoped) module_load_include() calls are executed but without result (see 'file: mymodule.module' in my question above).

I had to modify my module, including a dedicated module_load_include() call inside each function which needed it, like this:

&lt;?php

function mymodule_some_hook() {
    module_load_include('inc', 'mymodule', 'mymodule.core');
    # ...
    myfunction();
    # ...
}


This way, now all works fine anew.

I verified it is the same with Drupal 7.36: my module doesn't work in its original implementation, then it does with this modification.

Hope this helps.