On the toplevel, the predicate prints itself. But why?
?- put_attr(X,my_module,x). put_attr(X, my_module, x).
?- put_attr(X,my_module,foo), get_attr(X,my_module,Z). Z = foo, put_attr(X, my_module, foo).
It's probably like dif/2 (or even exactly the same as dif/2, the implementation is likely the same), which prints the "delayed goal" if it is still live at query success:
?- dif(X,a),(X=1;Y=2). X = 1 ; % dif/2 constraint cleared Y = 2, % dif/2 constraint still live dif(X, a).