Fennel wiki: your-own-modules

To create and use your own lib/my-module.fnl:

$ cd my-project
$ tree
├── lib
│   └── my-module.fnl
└── my-program.fnl

In lib/my-module.fnl:

(fn say-hi [s]
  (print (.. "Hi, " s "!")))

(fn add-em [a b]
  (+ a b))

;; This table is returned when you `require` the module.
{: say-hi
 : add-em}

In my-program.fnl:

#!/usr/bin/env fennel

(local my-m (require :lib.my-module))

(my-m.say-hi "Module")
(print (my-m.add-em 1 3))

Make your program executable: chmod +x my-program.fnl, and run it:

$ ./my-program.fnl 
Hi, Module!

For more info on modules, see the modules section of the tutorial.