Running EBM model in a function

Hello everyone,

Im running EBM model inside a function which is causing issue with calling model properties values. Is there a way to extract them inside function?

General Idea of my function:

model = model_initiate()

function test_run()
   for i in 1:10
    mm = i                       # its a model property                                                
                                 #that I want to chnage in                                                                        
                                 # every iteration 
     model = model_initiate()         # And thats why I                                    
                                   # repeat initialisation
     run!(model, steps)
     println(model.xx)
   end
end

now problem is this model.xx is different if I print outside of function. Basically what is happening is run updates global model while this local model stay at initial value. Is there a way to update local model when I run model?

As usual, please provide a complete MWE, full stacktrace, and a proper description of your experienced issue and the expected behaviour.