We provide a sample session for compiling, dynamically loading, and querying a user-defined module named quick_sort. For this example we assume that quick_sort is a file in the current working directory, and contains the definitions of the predicates concat/3 and qsort/2, both of which are exported.
| ?- compile(quick_sort). [Compiling ./quick_sort] [quick_sort compiled, cpu time used: 1.439 seconds] yes | ?- import concat/3, qsort/2 from quick_sort. yes | ?- concat([1,3], , L), qsort(L, S). L = [1,3,2] S = [1,2,3] yes.
The standard predicate import/1 does not load the module containing the imported predicates, but simply informs the system where it can find the definition of the predicate when (and if) the predicate is called.