# Can't find import

**URL:** <https://discuss.ocaml.org/t/cant-find-import/16589>\
**Category:** Learning\
**Tags:** help, dune\
**Created:** [May 1, 2025, 1:50pm UTC](https://discuss.ocaml.org/t/cant-find-import/16589 "2025-05-01T13:50:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![TateStaples](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/tatestaples/32/5958_2.png) [@TateStaples](https://discuss.ocaml.org/u/TateStaples)\
**Post date:** [May 1, 2025, 1:50pm UTC](https://discuss.ocaml.org/t/cant-find-import/16589/1 "2025-05-01T13:50:45Z")

</div>

Took an SML compilers class and I am trying to migrate my SML to OCaml. I have been struggling to get imports to work properly

File Structure:  
lib  
├── dune  
└── middle\_end  
\ ├── absyn.ml  
\ ├── symbol.ml  
\ ├── temp.ml  
\ ├── tree.ml  
\ └── types.ml

Lib/dune

```auto
(include_subdirs unqualified)
(library
 (name my_compiler)
 )

```

Files can read symbol.ml but not temp.ml and I can’t tell the difference

“The module Temp is an alias for module My\_compiler\_\_Temp, which is missing” ocamllsp

---

<div class="post-metadata">

**Author:** ![yawaramin](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/yawaramin/32/3384_2.png) [@yawaramin](https://discuss.ocaml.org/u/yawaramin)\
**Post date:** [May 1, 2025, 3:30pm UTC](https://discuss.ocaml.org/t/cant-find-import/16589/2 "2025-05-01T15:30:58Z")

</div>

Can you post the full error message with all context in the output?

---

<div class="post-metadata">

**Author:** ![JohnJ](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/johnj/32/6020_2.png) [@JohnJ](https://discuss.ocaml.org/u/JohnJ)\
**Post date:** [May 1, 2025, 5:02pm UTC](https://discuss.ocaml.org/t/cant-find-import/16589/3 "2025-05-01T17:02:36Z")

</div>

Also, since it looks like your error is coming from ocamllsp, it would be helpful to run the build directly and get the full error that way, e.g. `dune build`.

---

<div class="post-metadata">

**Author:** ![TateStaples](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/tatestaples/32/5958_2.png) [@TateStaples](https://discuss.ocaml.org/u/TateStaples)\
**Post date:** [May 1, 2025, 5:21pm UTC](https://discuss.ocaml.org/t/cant-find-import/16589/4 "2025-05-01T17:21:26Z")

</div>

`dune build` doesn’t error, however I would still like for the lsp to be functional before I continue adding files

---

<div class="post-metadata">

**Author:** ![yawaramin](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/yawaramin/32/3384_2.png) [@yawaramin](https://discuss.ocaml.org/u/yawaramin)\
**Post date:** [May 1, 2025, 5:22pm UTC](https://discuss.ocaml.org/t/cant-find-import/16589/5 "2025-05-01T17:22:15Z")

</div>

If `dune build` is succeeding, try restarting your editor. The LSP might have just gotten stuck.

---

<div class="post-metadata">

**Author:** ![R\_Huxton](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/r_huxton/32/4216_2.png) [@R\_Huxton](https://discuss.ocaml.org/u/R_Huxton)\
**Post date:** [May 1, 2025, 5:47pm UTC](https://discuss.ocaml.org/t/cant-find-import/16589/6 "2025-05-01T17:47:22Z")

</div>

I do find with neovim+lsp sometimes I need to reload a file to clear an error. Particularly in cases where I may have restructured the code and maybe created a couple of new modules.
