You want include, not require.

 -- John

On Dec 11, 2014, at 7:25 PM, Test This <curiousle...@gmail.com> wrote:

> 
> I have two files: dataTypes.jl and paramcombos.jl
> 
> In dataTypes.jl I have 
> 
> type Params
>      .
>      . // field names and types
>      .
> end
> 
> 
> In paramcombos.jl I have 
> 
> module paramcombos
> 
> require("dataTypes.jl")
> 
> function baseParams()
>        params = Params( field1 = blah1, field2 = blah2, ...)
> end
> 
> end
>  
> 
> In the julia repl if I do 
> 
> require("paramcombos.jl")
> 
> and then, 
> 
> basep = paramcombos.baseParams()
> 
> I get an error saying:
> 
> ERROR: Params not defined
>  in baseParams at /Users/code/paramcombos.jl:33 (where 33 is the line shown 
> above from baseParams() function. 
> 
> If I move type declaration to paramcombos.jl, things work fine. Is there a 
> way to keep type definitions in one file and use the constructor in another 
> file?
> 
> Thank you

Reply via email to