I have a module that i use to input some parameters (used in multiple functions etc, and I did not want to rewrite everywhere). They are lightly manipulated (basic scaling etc) and exported to various parts of a larger code.
Some of these parameters will be changed manually, and I wanted to run the program based on these updated parameters without restarting Julia (trying to avoid loading packages). Looks like the variable manipulations are not being carried out even when I use Revise.jl
Anyone have any suggestions
A MWE below
module Mymodule
x = 1
y = x*10
mygreeting() = "Hello, world!"
export x, y, mygreeting
end
The main file
using Revise
includet("MyFile.jl")
using Main.Mymodule
#accesssing from workspace directly
println(x)
println(y) #Does not update it's value
mygreeting()
println(Main.Mymodule.x)
println(Main.Mymodule.y) #Does not update it's value
println(Main.Mymodule.mygreeting())
The workflow in question
- Run the main file
- Update the module by
x = 2
andmygreeting() = "Hello, Revised world!"
- Run main file again
The variable x
and function mygreeting()
gets updated to the new values, but y
is still showing old value of 10
.
Is there some way of updating the value in y
9 posts - 3 participants