5.14 Query the module system

The following predicates can be used to query the module system for reflexive programming:

[nondet]current_module(?Module)
True if Module is a currently defined module. This predicate enumerates all modules, whether loaded from a file or created dynamically. Note that modules cannot be destroyed in the current version of SWI-Prolog.
module_property(?Module, ?Property)
True if Property is a property of Module. Defined properties are:
file(?File)
True if Module was loaded from File.
line_count(-Line)
True if Module was loaded from the N-th line of file.
exports(-ListOfPredicateIndicators)
True if Module exports the given predicates. Predicate indicators are in canonical form (i.e., always using Name/Arity and never the DCG form Name//Arity). Future versions may also use the DCG form and include public operators. See also predicate_property/2.