Module import/using paths are always absolute (from Main), unless prefixed
by one (or more) dots. So for this example, try:
using .SubModule

On Sat, Jul 25, 2015 at 10:15 AM Jeffrey Sarnoff <[email protected]>
wrote:

> src/SubModule.jl defines the SubModule
> removing "using SubModule" and accessing subThing with SubModule.subThing
> does work (and I had not tried that)
> so that helps -- thank you
>
> On Saturday, July 25, 2015 at 10:00:29 AM UTC-4, Tero Frondelius wrote:
>>
>> Maybe it's otherwise ok, just remove "using SubModule". I assume that
>> your "src/file2.jl" defines the SubModule and when you include it you don't
>> have to write using SubModule at all. Or I just misunderstood your
>> question.
>>
>> On Saturday, July 25, 2015 at 4:45:29 PM UTC+3, Jeffrey Sarnoff wrote:
>>>
>>> above should read
>>>
>>> Package.jl
>>>    module Package
>>>       include("src/file1.jl")
>>>       include( "src/submodule.jl")
>>>       using SubModule
>>>       include( "src/file2.jl" ) # needs subThing
>>>    end
>>>
>>> On Saturday, July 25, 2015 at 9:41:47 AM UTC-4, Jeffrey Sarnoff wrote:
>>>>
>>>> I have a package layed out something like this:
>>>>
>>>> Package
>>>>    Package.jl
>>>>    src
>>>>         file1.jl
>>>>         submodule.jl
>>>>              module SubModule
>>>>                  export subThing
>>>>              end
>>>>         file2.jl
>>>>              ...use subThing...
>>>>
>>>> Package.jl
>>>>    include("src/file1.jl")
>>>>    include( "src/submodule.jl")
>>>>    using SubModule
>>>>    include( "src/file2.jl" )
>>>>
>>>> which causes (v0.4) ERROR: LoadError: ArgumentError: Sub not found in
>>>> path
>>>>    and so does
>>>>    ... import SubModule: subThing
>>>>
>>>> Is there a way to do this without making SubModule a separate package?
>>>>
>>>

Reply via email to