New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
include file containing module #2849
Comments
I just read a post on Zulip about using a module defined in a cell in Pluto. maybe there is a function that does 2024-03-13.20.44.28.mp4 |
We could replace macro using_local_modules(MyModule)
return :(eval(Meta.parse(join(string.(names($MyModule)[2:end]), ", ") *
" = " * split(string($MyModule), ".")[end] * "." * join(string.(names($MyModule)[2:end]), ", "*split(string($MyModule), ".")[end] * "."))))
end and run |
Related to #1795. |
@dorn-gerhard since you are already defining a module for your things, if you are wililng to simply put it inside a package structure you can try You can check the docs for more details or you can write me directly if you need help. |
Hi,
I wanted to ask for a best practise for including a self-written module
MyModule.jl
and having allexported functions (
my_function
) within the workspace of the Pluto notebook available instead ofMyModule.my_function
Workaround would be of course to create a package.
But relating to #115 it would be cool to first load the file
ingredient("./MyModule.jl")
and then use the module with all exported functions.Interestingly
using .MyModule
orusing .MyModule: my_function
is not working.When using
include("MyModule.jl")
using .MyModule
is not working butusing .MyModule: my_function
is working (see video below).So I thought what about creating a function that loads all my exported functions (
names(MyModule)
):but that does only work in the same cell.
So what is the best way to use a self-written module saved in a file.jl within Pluto?
2024-03-13.20.31.25.mp4
The text was updated successfully, but these errors were encountered: