Can't find module -- doing something dumb

Hello, I am experimenting with channels and am having trouble with module names – am doing something dumb.

The error message is

== Compilation error on file lib/koko_web/endpoint.ex ==
** (CompileError) lib/koko_web/endpoint.ex:4: module Koko.Web.RoomChannel is not loaded and could not be found

The relevant directory structure is

jxxmbp:koko_umbrella carlson$ tree apps/koko_web/lib/koko_web/
apps/koko_web/lib/koko_web/
├── application.ex
├── channels
│   ├── room_channel.exs
│   └── user_socket.ex
├── controllers
...
├── endpoint.ex

In file room_channel.exs I have

defmodule Koko.Web.RoomChannel do 
...

and in endpoint.ex there is

  import Koko.Web.RoomChannel

Change the file extension of room_channel.exs to .ex. .ex is for compiled code; .exs is for interpreted code.

1 Like

Opening an .exs still compiles the code, it’s just a matter of whether the code is automatically compiled and loaded or not.

1 Like

Thank you !!

Thankyou !!

You’re right; misunderstood exactly how .exs worked.