The built-in predicate current_module/2 can be used to find
all the currently loaded module, and where they were loaded from.
See mpg-ref-current_module.
current_module(?M)
M is the name of a current module
current_module(?M,?F)
F is the name of the file in which M's module
declaration appears. Not all modules have a corresponding file.