@/2 changes only the context module, not the lookup module. I.e. the way the definition of Goal is found is not affected at all. To specify the lookup module, use :/2. The following table summarises:
Call within module(m) lookup module caller module ..., twice(X), ... m m ..., lm : twice(X), ... lm m ..., twice(X) @ cm, ... m cm ..., lm : twice(X) @ cm, ... lm cm ..., call(twice(X)) @ cm, ... cm cmIf Goal is not a tool-predicate, then Goal@ContextModule is completely equivalent to Goal.
[eclipse 1]: [user]. :- tool(where/0, where/1). where(Module) :- printf("where/0 was called from module %w\n", [Module]). ^D [eclipse 2]: where. where/0 was called from module eclipse yes. [eclipse 3]: where @ m. where/0 was called from module m yes. [eclipse 4]: call(where) @ m. calling an undefined procedure where in module m [eclipse 1]: [user]. :- tool(print_local_preds/0, print_local_preds/1). print_local_preds(Module) :- current_predicate(P) @ Module, get_flag(P, visibility, local) @ Module, writeln(P), fail. ^D [eclipse 2]: print_local_preds. print_local_preds / 0 print_local_preds / 1