The concept of a source module is explained in ref-mod-som. For any goal, the applicable source module is determined when the goal is compiled rather than when it is executed.
A procedure that needs to refer to the source module has arguments
designated for module name expansion. These arguments are expanded
when code is consulted, compiled or asserted
by the transformation X -> M:X where M is the
name of the source module. For example, the goal call(X) is
expanded into call(M:X) and the goal clause(Head, Body)
is expanded into clause(M:Head, Body).
Module name expansion is avoided if the argument to be expanded is
already a :/2 term. In this case it is unnecessary since the
module to be used has already been supplied by the programmer.