This will load foo.ml and all its dependencies in the toplevel (without using the foo.mli interface if there is one, so you can access Foo’s internal functions).
the problem with both of these, if they seem to fight with dune build -w over some directory (I have no idea why)
dune utop; echo "==="; dune ocaml top-module foo.ml
Error: A running dune (pid: 1359440) instance has locked the build directory.
If this is not the case, please delete _build/.lock
===
Error: A running dune (pid: 1359440) instance has locked the build directory.
If this is not the case, please delete _build/.lock
ocaml --version; echo "==="; dune --version;
The OCaml toplevel, version 5.0.0
===
3.6.1
Indeed I haven’t tried to simultaneously run dune build -w and the dune ocaml top-module invocation. Maybe the conflict is worth reporting on the dune side? (or maybe that’s not a supported use case, I have no idea)