Need to include one file multiple times, how to avoid warning

You should not need to include the same file multiple times in Julia, so the answer to your question is “don’t do that”. This is an important difference between the way Julia and C++ are used. Instead, you can do:

module A

include("B.jl")
using .B

module C
  using ..B
end

end

Where B.jl looks like:

module B
...
end

The using ..B line lets you load the B module from A inside C without having to include it twice.

4 Likes