If your custom loss function uses internal parameters or some other arguments, I would use the nn.Module approach as it will properly encapsulate all attributes.
On the other hand you could just define a method, if you are using a pure functional approach.