@which not found in my module

I would like to use @which from within a macro to find out where a particular function is called from. But I get a message that the macro is not found. How is this handled? Thanks.

If it is from a script you can try loading InteractiveUtils.

Or you can try using the function which results from the macro, for example, these two are equivalent:

julia> @which sum(2)
sum(a; kw...) in Base at reduce.jl:557

julia> InteractiveUtils.which(sum,(Base.typesof)(2))
sum(a; kw...) in Base at reduce.jl:557

1 Like