Appropriate Structures for Reusing Code

I’ve recently been forced to relearn python for a work application. Needless to say, after working with Julia for a while, there were plenty of things I found a little painful (vectorisation, the need to use numba/cython or even write in native C, etc.) However, one thing I did find helpful was how easy it was to structure your code in python, in such a way that it could easily be re-used. The ability to write a module with a bunch of useful functions once and then ever-after type “from xxx import yyy as zzz” is really nice.

Is there an equivalent structure in Julia, which can allow for easy reusability of key code?

1 Like

Yes. There are modules, and they act the same way. Julia packages are just a module like this.


Yea like Chris said you can make a package and import it(,

Or if you’re hacking away prototyping you can also using
and it will run all the code in the specified file(

Well… that was simple. Thanks!

1 Like

You’ll probably find this easier in Julia than python :slight_smile:

There are also helpers like to auto generate the package structure with docs, Travis/appveyor testing and everything already set up.

1 Like