Loading file using module

Let’s say I’m using module x.

?- module(x).
Warning: x is not a current module (created)

x:  ?- 

Code will be evaluated using x.

x:  ?- ensure_loaded(sum_file).

sum_file is not evaluated as a x file *music rolls*. Anyway, how do I load file in the same mode?edit:it already does? problem was somewhere else. nvm

Same module? If sum_file.pl is not a module file, its code is loaded in the module x. If it is a module file, the code will be loaded into the module defined in the file and the exported predicates are imported into x.