You can check out the Requires.jl
<https://github.com/one-more-minute/Requires.jl> package which has very
nice shorthand syntax for this sort of thing:
@require PyPlot begin
# This block is only executed when PyPlot is loaded
# Inside this block you can either refer to PyPlot objects with their
fully qualified names (PyPlot.imshow)
# Or simply call:
using PyPlot
# ... PyPlot glue code here
end
Matt
On Friday, March 13, 2015 at 4:31:00 AM UTC-4, antony schutz wrote:
>
> Hi
>
>
> Thanks to answer, please try this :
>
>
>
> *julia> **Pkg.clone("https://github.com/DeVerMyst/MyModule.git
> <https://github.com/DeVerMyst/MyModule.git>")*
>
> *INFO: Cloning MyModule from https://github.com/DeVerMyst/MyModule.git
> <https://github.com/DeVerMyst/MyModule.git>*
>
> *INFO: Computing changes...*
>
> *julia> **exit()*
>
> *➜ **~ * julia
>
> *_*
>
> *_** _ **_**(_)**_** | A fresh approach to technical
> computing*
>
> *(_)** | **(_)* *(_)** | Documentation:
> http://docs.julialang.org <http://docs.julialang.org>*
>
> * _ _ _| |_ __ _ | Type "help()" for help.*
>
> * | | | | | | |/ _` | |*
>
> * | | |_| | | | (_| | | Version 0.3.4 (2014-12-26 10:42 UTC)*
>
> * _/ |\__'_|_|_|\__'_| | Official http://julialang.org/
> <http://julialang.org/> release*
>
> *|__/ | x86_64-apple-darwin13.4.0*
>
>
> *julia> **using MyModule*
>
>
> *julia> **mymainfct(2,2,true)*
>
> *ERROR: imshow not defined*
>
> * in mymainfct at /Users/antonyschutz/.julia/v0.3/MyModule/src/mymain.jl:7*
>
>
> *julia> **using PyPlot*
>
> *INFO: Loading help data...*
>
>
> *julia> **mymainfct(2,2,true)*
>
> *ERROR: imshow not defined*
>
> * in mymainfct at /Users/antonyschutz/.julia/v0.3/MyModule/src/mymain.jl:7*
>
>
>
>
>
> Le jeudi 12 mars 2015 16:07:22 UTC+1, antony schutz a écrit :
>>
>>
>> Hello
>>
>> I'm trying to generalize an algorithm for alpha user.
>> The algorithm can draw plot but I dont want this to be mandatory, so in
>> the "module" i don't import the library (for example, i dont call "using
>> PyPlot")
>> I want the plot drawing to be an option and has to be done by the user.
>>
>> Unfortunately, when I call "using Pyplot" and if i am not working in the
>> folder containing the module, the package is not recognized by the
>> algorithm.
>>
>> module mymodule
>> using needed_library
>> export needed_function
>> include("needed_files")
>> end
>>
>> julia> using mymodule
>> julia> using PyPlot
>>
>> *INFO: Loading help data...*
>>
>>
>> *ERROR: figure not defined*
>>
>>
>> I tried to define 2 module with different name but I can't load the
>> second module (mymodulePyPlot) because the module is inside folder
>> "mymodule" and not in folder "mymodulePyPlot"
>>
>>
>> Is somebody know a solution to this problem ?
>>
>>
>> Thanks in advance
>>
>