# Problems reading data with JLD (edited title)

**URL:** <https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775>\
**Category:** New to Julia\
**Created:** [June 20, 2020, 2:41pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775 "2020-06-20T14:41:32Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbpatzer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbpatzer/32/15355_2.png) [@jbpatzer](https://discourse.julialang.org/u/jbpatzer)\
**Post date:** [June 20, 2020, 2:41pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/1 "2020-06-20T14:41:32Z")

</div>

I have a working code that consists of lots of separate .jl files.

I have a file “Code.jl” that includes them all in the form

```julia
using Package1, Package2

include("Function1.jl")
include("Function2.jl")

```

I type `include("Code.jl")` in the REPL, and everything is available to me, and works fine.

Now I’m trying to make a module, and hopefully later a package, by changing “Code.jl” to

```julia
module Code
export Function1
using Package1, Package2

include("Function1.jl")
include("Function2.jl")
end

```

After restarting julia, I type `include("Code.jl")` and `using .Code’ in the REPL. Now when I call Function1, it starts to run, but I get a splurge of errors that seem to be related to the packages that I am trying to use and it crashes.

I’ve tried to write a simpler example than my actual code that reproduces this error, but I can’t. I’m happy to post the actual code and error, but I wanted to check whether I was doing something fundamentally misguided before doing that.

Thanks,

JB

---

<div class="post-metadata">

**Author:** ![bernhard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernhard/32/2619_2.png) [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Post date:** [June 20, 2020, 2:48pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/2 "2020-06-20T14:48:29Z")

</div>

> [@jbpatzer](#):
>
> `using Package1, Package2`

Did you add those two packages to the Project.toml of Code (via Pkg.add(…) after activating the „Code“ environment)

If you would use Pkg.generate(„Code“) or maybe even PkgSkeleton.jl that might help you to create a proper environment.

---

<div class="post-metadata">

**Author:** ![jbpatzer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbpatzer/32/15355_2.png) [@jbpatzer](https://discourse.julialang.org/u/jbpatzer)\
**Post date:** [June 20, 2020, 3:30pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/3 "2020-06-20T15:30:02Z")

</div>

Sorry, but I don’t understand. I’m starting by trying to make a module, not a package. I have not done the things that you mention.

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [June 20, 2020, 3:43pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/4 "2020-06-20T15:43:41Z")

</div>

Post the actual error. Without it, it is hard to say what is going on (for me at least).

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [June 20, 2020, 3:47pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/5 "2020-06-20T15:47:40Z")

</div>

You may have used `using` in the repl. Then running `include("Code.jl")` would “know” about packages that are referenced in the code. Now if you make it into a module, the code inside does not have access to the same `using`s as before. You have to add them manually.

---

<div class="post-metadata">

**Author:** ![jbpatzer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbpatzer/32/15355_2.png) [@jbpatzer](https://discourse.julialang.org/u/jbpatzer)\
**Post date:** [June 20, 2020, 3:57pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/6 "2020-06-20T15:57:21Z")

</div>

> [@tbeason](#):
>
> Post the actual error. Without it, it is hard to say what is going on (for me at least).

I will, but am on my mobile atm.

> [@PetrKryslUCSD](#):
>
> You may have used `using` in the repl. Then running `include("Code.jl")` would “know” about packages that are referenced in the code. Now if you make it into a module, the code inside does not have access to the same `using` s as before. You have to add them manually.

Not sure what you mean by ‘may have’. I’ve done the things I said after typing exit() and starting a new session so there are no stray 'using’s about.

But how do I ‘add them manually’? I want everything self-contained in the module. None of the individual files have any ‘using’ statements in them

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [June 20, 2020, 4:22pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/7 "2020-06-20T16:22:49Z")

</div>

File `"f.jl"`:

```julia
f(x, y) = mean([x, y])

```

Then do

```julia
julia> include("f.jl");

julia> f(1, 3)                                                       
ERROR: UndefVarError: mean not defined                               
Stacktrace:                                                          
 [1] f(::Int64, ::Int64) at .\f.jl:1                                                          
 [2] top-level scope at REPL[2]:1                                    
                                                                     
julia> using Statistics                                              
                                                                     
julia> f(1, 3)
2.0       

```

One must pull in `Statistics` so that the function `f` can do its job.

So now that works, let’s try creating a module as

```julia
module M

include("f.jl")

end

```

Now we include `"M.jl"`:

```julia
julia> include("M.jl");       

julia> Main.M.f(1, 3)                                                            
ERROR: UndefVarError: mean not defined                                           
Stacktrace:                                                                      
 [1] f(::Int64, ::Int64) at .\f.jl:1 
 [2] top-level scope at REPL[7]:1                                                
                                                                                 
julia> 

```

Notice that again `mean` is not available. We have to say explicitly `using Statistics` in `"M.jl"`.

```julia
module M

using Statistics
include("f.jl")

end

```

Now it works

```julia
julia> include("M.jl");
WARNING: replacing module M.                                                     

julia> Main.M.f(1, 3)
2.0         

```

---

<div class="post-metadata">

**Author:** ![jbpatzer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbpatzer/32/15355_2.png) [@jbpatzer](https://discourse.julialang.org/u/jbpatzer)\
**Post date:** [June 20, 2020, 4:32pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/8 "2020-06-20T16:32:45Z")

</div>

If you look at what I posted, that’s exactly what I’ve done. I will post the code and error when I’m back on my laptop.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [June 20, 2020, 5:05pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/9 "2020-06-20T17:05:25Z")

</div>

Sure. You haven’t posted the error, so I am **guessing** one package must have been missed when creating the module.

---

<div class="post-metadata">

**Author:** ![jbpatzer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbpatzer/32/15355_2.png) [@jbpatzer](https://discourse.julialang.org/u/jbpatzer)\
**Post date:** [June 20, 2020, 5:53pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/10 "2020-06-20T17:53:29Z")

</div>

OK. Here’s the module code (not all the individual files ofc)

```nohighlight

export Solution,
    Params, Target, Path, Beamparams, initialise, etch, outplot, makegcode

using Dierckx,
    CSV,
    Roots,
    QuadGK,
    Polynomials,
    SparseArrays,
    OSQP,
    Printf,
    Statistics,
    AbstractPlotting.MakieLayout,
    AbstractPlotting,
    GLMakie,
    Colors,
    ColorSchemes,
    FileIO,
    JLD,
    Interpolations

include("Params.jl")
include("Beamparams.jl")
include("Target.jl")
include("Path.jl")
include("Solution.jl")
include("initialise.jl")
include("makeinterpolant.jl")
include("calibration.jl")
include("makerange.jl")
include("findtracks.jl")
include("rasterpaths.jl")
include("joinpaths.jl")
include("Dmap.jl")
include("invDmap.jl")
include("makeinfluencematrix.jl")
include("makesmoothingmatrix.jl")
include("refinetarget.jl")
include("inversesolve.jl")
include("outplot.jl")
include("GSsearch.jl")
include("optimize_Zrange.jl")
include("compresspath.jl")
include("makemaskpath.jl")
include("find_dtheta.jl")
include("etch.jl")
include("findgradient.jl")
include("improve_path.jl")
include("optimise_paths.jl")
include("optimiseoverlap.jl")
include("makegcode.jl")

end

```

Here’s the complete REPL history when I try to use it

```julia
julia> include("Etching.jl");

julia> using .Etching

julia> sol, sol0 = etch("coin",25.0,2; Zrange = 0.5);
target = coin, size = 25.0.
┌ Warning: type Interpolations.FilledExtrapolation{Core.Float64,3,Interpolations.GriddedInterpolation{Core.Float64,3,Core.Float64,Interpolations.Gridded{Interpolations.Linear},Core.Tuple{Base.StepRangeLen{Core.Float64,Base.TwicePrecision{Core.Float64},Base.TwicePrecision{Core.Float64}},Core.Array{Core.Float64,1},Core.Array{Core.Float64,1}}},Interpolations.Gridded{Interpolations.Linear},Core.Float64} not present in workspace; reconstructing
└ @ JLD C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:697
┌ Warning: type Interpolations.GriddedInterpolation{Core.Float64,3,Core.Float64,Interpolations.Gridded{Interpolations.Linear},Core.Tuple{Base.StepRangeLen{Core.Float64,Base.TwicePrecision{Core.Float64},Base.TwicePrecision{Core.Float64}},Core.Array{Core.Float64,1},Core.Array{Core.Float64,1}}} not present in workspace; reconstructing
└ @ JLD C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:697
┌ Warning: type Interpolations.Gridded{Interpolations.Linear} not present in workspace; reconstructing
└ @ JLD C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:697
┌ Warning: type Interpolations.Linear not present in workspace; reconstructing
└ @ JLD C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:697
ERROR: MethodError: Cannot `convert` an object of type JLD.var"##Interpolations.FilledExtrapolation{Core.Float64,3,Interpolations.GriddedInterpolation{Core.Float64,3,Core.Float64,Interpolations.Gridded{Interpolations.Linear},Core.Tuple{Base.StepRangeLen{Core.Float64,Base.TwicePrecision{Core.Float64},Base.TwicePrecision{Core.Float64}},Core.Array{Core.Float64,1},Core.Array{Core.Float64,1}}},Interpolations.Gridded{Interpolations.Linear},Core.Float64}#325" to an object of type Interpolations.FilledExtrapolation{Float64,3,Interpolations.GriddedInterpolation{Float64,3,Float64,Interpolations.Gridded{Interpolations.Linear},Tuple{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}},Array{Float64,1},Array{Float64,1}}},Interpolations.Gridded{Interpolations.Linear},Float64}
Closest candidates are:
  convert(::Type{T}, ::T) where T<:AbstractArray at abstractarray.jl:14
  convert(::Type{T}, ::LinearAlgebra.Factorization) where T<:AbstractArray at C:\Users\pmzjb1\AppData\Local\JuliaPro-1.4.2-1\Julia-1.4.2\share\julia\stdlib\v1.4\LinearAlgebra\src\factorization.jl:55
  convert(::Type{S}, ::T) where {S, T<:(Union{CategoricalArrays.CategoricalString{R}, CategoricalArrays.CategoricalValue{T,R} where T} where R)} at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\CategoricalArrays\dmrjI\src\value.jl:103
  ...
Stacktrace:
 [1] macro expansion at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:422 [inlined]
 [2] jlconvert(::Type{Beamparams}, ::JLD.JldFile, ::Ptr{UInt8}) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:551
 [3] read_scalar_default(::JLD.JldDataset, ::HDF5.HDF5Datatype, ::Type{T} where T) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:400
 [4] read_scalar(::JLD.JldDataset, ::HDF5.HDF5Datatype, ::Type{T} where T) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:396
 [5] read(::JLD.JldDataset) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:367
 [6] read(::JLD.JldFile, ::String) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:343
 [7] #49 at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:1258 [inlined]
 [8] map at .\tuple.jl:158 [inlined]
 [9] #48 at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:1258 [inlined]
 [10] jldopen(::JLD.var"#48#50"{Tuple{String,String}}, ::String, ::Vararg{String,N} where N; kws::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:243
 [11] jldopen(::Function, ::String, ::String) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:241
 [12] load(::FileIO.File{FileIO.DataFormat{:JLD}}, ::Tuple{String,String}) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:1257
 [13] load(::FileIO.File{FileIO.DataFormat{:JLD}}, ::String, ::String) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\JLD.jl:1255
 [14] load(::String, ::String, ::Vararg{String,N} where N; options::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\FileIO\ZknoK\src\loadsave.jl:118
 [15] load at C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\FileIO\ZknoK\src\loadsave.jl:118 [inlined]
 [16] etch(::String, ::Float64, ::Int64; Zmin::Float64, Zmax::Float64, Zrange::Float64, maskfiles::String, gcodeflag::Bool, dirname::String, plotflag::Bool, saveflag::Bool, verbose::Bool, straightflag::Bool, overlap::Float64, gamma::Float64, dsmin::Float64, dsmax::Float64, dthetamax::Float64, order::Int64, vmin::Float64, vmax::Float64, pixellength::Float64, linsys_solver::String, eps_abs::Float64, eps_rel::Float64) at C:\Users\pmzjb1\Google Drive\LaserJet Julia Project\etch.jl:76
 [17] top-level scope at none:0

```

It looks like something to do with the packages JLD and Interpolations to me, but I don’t really know what.

Just to emphasise, when I don’t try to make this a module, and just have the ‘using’ statement and the list of 'include’s, it works fine, so I don’t see how I can be missing something in the ‘using’ list.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [June 20, 2020, 9:04pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/11 "2020-06-20T21:04:23Z")

</div>

It looks like your reading from HDF5 (JLD)? Are you sure all types have been defined before you read?

---

<div class="post-metadata">

**Author:** ![jbpatzer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbpatzer/32/15355_2.png) [@jbpatzer](https://discourse.julialang.org/u/jbpatzer)\
**Post date:** [June 20, 2020, 9:38pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/12 "2020-06-20T21:38:12Z")

</div>

Yes, because everything works until I make it a module.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [June 20, 2020, 9:46pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/13 "2020-06-20T21:46:10Z")

</div>

Well, my thinking is the only difference seems to be that the module has its own environment.  
Seems something is not defined in that environment because the way I read the error it seems there was a failure constructing some data structure.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [June 20, 2020, 10:02pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/14 "2020-06-20T22:02:51Z")

</div>

Since you are not loading your module as a package, you need to add the directory to your module to LOAD\_PATH.

```julia
push!(LOAD_PATH, "path_to_my_module")
using my_module

```

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [June 20, 2020, 10:22pm UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/15 "2020-06-20T22:22:19Z")

</div>

OK. How about this: you wrote the JLD file from the command line, but you are  
reading it when you have a module. Those types may be different then. (BeamParams, in particular.)

---

<div class="post-metadata">

**Author:** ![jbpatzer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbpatzer/32/15355_2.png) [@jbpatzer](https://discourse.julialang.org/u/jbpatzer)\
**Post date:** [June 21, 2020, 6:55am UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/16 "2020-06-21T06:55:05Z")

</div>

The jld file isn’t written from the command line. There’s an initialise function that writes it, so I don’t think it’s that. I have some ideas, but I’m probably going to have to wait until tomorrow to work on it as it’s Father’s Day here in the UK and I’m expecting to be treated like a king by my family… although that’s not guaranteed!

---

<div class="post-metadata">

**Author:** ![grahamstark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/grahamstark/32/5200_2.png) [@grahamstark](https://discourse.julialang.org/u/grahamstark)\
**Post date:** [June 21, 2020, 9:26am UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/17 "2020-06-21T09:26:49Z")

</div>

Happy father’s day!

If Julia knows about `Interpolations` in one setting and not another, could the problem here be a confusion between a package and a module? A package, as you probably know, has its own environment which you have to explicitly set up, including adding all the dependencies yourself.

There’s a [very good video on the mechanics of setting up a package and adding all the dependencies](https://www.youtube.com/watch?v=tx8DRc7_c9I).

Graham

---

<div class="post-metadata">

**Author:** ![jbpatzer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbpatzer/32/15355_2.png) [@jbpatzer](https://discourse.julialang.org/u/jbpatzer)\
**Post date:** [June 21, 2020, 9:37am UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/18 "2020-06-21T09:37:02Z")

</div>

I’m not sure. The only place a ‘using Interpolations’ statement occurs is in that module.

I’ll definitely watch the video. I’m hoping to be able to turn it into a package without having to come back to this forum.

---

<div class="post-metadata">

**Author:** ![jbpatzer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbpatzer/32/15355_2.png) [@jbpatzer](https://discourse.julialang.org/u/jbpatzer)\
**Post date:** [June 21, 2020, 11:35am UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/19 "2020-06-21T11:35:46Z")

</div>

I told my long-suffering family that what I most want to do for Father’s Day is get this bloody Module sorted out.

Here’s the minimal code to reproduce the problem.

```julia
module Testmodule

using JLD, Interpolations

export Function1, Function2

function Function1()
    f = LinearInterpolation(vec(collect(1.0:5.0)), rand(Float64,5))
    save("test.jld","f",f)
end

function Function2(x::Float64)
    f = load("test.jld","f")
    println(f(x))
end
end

```

And now in the REPL, Function1 saves the interpolant and Function2 tries to load and use it.

```julia
julia> include("Testmodule.jl");

julia> using .Testmodule

julia> Function1()

julia> Function2(0.5)
┌ Warning: type Interpolations.Extrapolation{Core.Float64,1,Interpolations.GriddedInterpolation{Core.Float64,1,Core.Float64,Interpolations.Gridded{Interpolations.Linear},Core.Tuple{Core.Array{Core.Float64,1}}},Interpolations.Gridded{Interpolations.Linear},Interpolations.Throw{Core.Nothing}} not present in workspace; reconstructing
└ @ JLD C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:697
┌ Warning: type Interpolations.Throw{Core.Nothing} not present in workspace; reconstructing
└ @ JLD C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:697
┌ Warning: type Interpolations.GriddedInterpolation{Core.Float64,1,Core.Float64,Interpolations.Gridded{Interpolations.Linear},Core.Tuple{Core.Array{Core.Float64,1}}} not present in workspace; reconstructing
└ @ JLD C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:697
┌ Warning: type Interpolations.Gridded{Interpolations.Linear} not present in workspace; reconstructing
└ @ JLD C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:697
┌ Warning: type Interpolations.Linear not present in workspace; reconstructing
└ @ JLD C:\Users\pmzjb1\.juliapro\JuliaPro_v1.4.2-1\packages\JLD\jeGJb\src\jld_types.jl:697
ERROR: MethodError: objects of type JLD.var"##Interpolations.Extrapolation{Core.Float64,1,Interpolations.GriddedInterpolation{Core.Float64,1,Core.Float64,Interpolations.Gridded{Interpolations.Linear},Core.Tuple{Core.Array{Core.Float64,1}}},Interpolations.Gridded{Interpolations.Linear},Interpolations.Throw{Core.Nothing}}#253" are not callable
Stacktrace:
 [1] Function2(::Float64) at C:\Users\pmzjb1\Google Drive\LaserJet Julia Project\Testmodule.jl:14
 [2] top-level scope at none:0

```

Is this a problem with JLD and/or Interpolations that I should be posting elsewhere? I have no idea what’s going on.

---

<div class="post-metadata">

**Author:** ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Post date:** [June 21, 2020, 11:54am UTC](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775/20 "2020-06-21T11:54:13Z")

</div>

This is probably unsatisfying, but have you tried `using Interpolations` at the REPL before calling `Function2`?  
Otherwise `Interpolations` won’t “be defined in the workspace”.

[Next page](https://discourse.julialang.org/t/problems-reading-data-with-jld-edited-title/41775.md?page=2)
