SWI-Prolog 5.11.18 Reference Manual: Section 5.3

## 5.3 Importing Predicates into a Module

Predicates can be added to a module by importing them from another module. Importing adds predicates to the namespace of a module. An imported predicate can be called exactly the same as a locally defined predicate, although its implementation remains part of the module in which it has been defined.

Importing the predicates from another module is achieved using the directives use_module/1 or use_module/2. Note that both directives take file name(s) as arguments. I.e., modules are imported based on their file name rather than their module name.

use_module(+Files)
  Load the file(s) specified with File just like ensure_loaded/1. The files must all be module files. All exported predicates from the loaded files are imported into the module from which this predicate is called. This predicate is equivalent to ensure_loaded/1, except that it raises an error if File is not a module file.
use_module(+File, +ImportList)
  Load File, which must be a module file and import the predicates as specified by ImportList. ImportList is a list of predicate indicators specifying the predicates that will be imported from the loaded module. ImportList also allows for renaming or import-everything-except. See also `import` option of load_files/2. The first example below loads member/2 from the lists library and append/2 under the name `list_concat`, which how this predicate is named in YAP. The second example loads all exports from library option, except for meta_options/3. These renaming facilities are generally used to deal with portability issues with as few as possible changes to the actual code. See also section C and section 5.7.

      :- use_module(library(lists), [ member/2,
                                      append/2 as list_concat
                                    ]).
      :- use_module(library(option), except([meta_options/3])).

The module/2 directive, use_module/1 and use_module/2 are sufficient to partition a simple Prolog program into modules. The SWI-Prolog graphical cross-referencing tool gxref/0 can be used to analyse the dependencies between non-module files and propose module declarations for each file.