1

I want to write a module in the local directory, load it into Jupyter and test it.

I put the module into file MyModule.jl:

module MyModule

export my_function

my_function() = ()

end

Then I load it in JupyterLab:

include("MyModule.jl")
using .MyModule

my_function()

This works fine with a fresh Julia kernel, but if I execute the cell the second time, I will get two warnings:

WARNING: replacing module MyModule.
WARNING: using MyModule.my_function in module Main conflicts with an existing identifier.

In principle, I can get rid of the second warning by switching from using to import, so to write MyModule.my_function(), but the first warning is always there.

I have tried adding using Revise, but it does nothing.

Yrogirg
  • 2,301
  • 3
  • 22
  • 33

1 Answers1

1

It seems that I found how to do it with Revise, the key is to use includet instead of just include:

using Revise

includet("MyModule.jl")
using .MyModule

my_function()
Yrogirg
  • 2,301
  • 3
  • 22
  • 33