Warning: Method definition (::Type{SIM.simulation})() in module SIM at /home/Desktop/myFile.jl:57 overwritten at /home/Desktop/myFile.jl:57

The code works earlier. But when I run it this time, I got the above warning as indicated by the title. I checked the line 57 of the file myFile.jl, and only to find that it is the constructor definition inside of the mutable struct Simulation. Nothing special. Could anyone please let me know how to resolve this warning issue?

Isn’t it just that you redefine the method every time you include the file, and thus get a warning that the method has been redefined?

Nice explanations I should say. :slight_smile: If I understand it correctly, I only include the file once, right? I mean, this file is included in the module file SIM. The module is only used once in my mode by
using SIM. Oh. I think I kind of know the reasons. In the driver file, my code is as the following:

push!(LOAD_PATH, "directory_to_SIM_module")
using SIM

So I guess I only need to stop and restart Julia again from a clean working environment session.

Does not quite work out. I still get this warning message even for a brand-new REPL Julius session.

To understand your problem, seeing the code that causes it would be very helpful

1 Like

I finally figured it out. It is mainly because I have included the same file twice in the module SIM using include("my_file.jl")