I've experienced this problem in several projects, but this test case removes everything that is unecessary to understanding the problem. I've been using it to figure out what's wrong:
So I have a directory with 2 files in it, foo.scm
, and bar.scm
:
;;;foo.scm
(module foo (baz)
(import chicken scheme)
(define (baz)
(display "bazzer!\n")))
;;;bar.scm
(module baz (quux)
(import chicken scheme)
(use foo)
(define (quux)
(baz)
(display "quuxed!\n")))
baz.scm fails to run in csi with this error:
Error: (import) during expansion of (import ...) - cannot import from undefined module: foo
I've checked the docs: use
should load the code into memory, and then import
it. I've even run require
, the function use
uses to load code, separately. It runs without a hitch, it's just import
that fails. I also tried to import the code in csi
. use
doesn't work, but require
followed by import
does, even though that should be equivalent to use
.
In short, I'm hopelessly confused. Can anybody explain what's going on, and how to fix it?