load modules when running elixir file from IntelliJ

I am trying to seed a database using Elixir, the Elixir file is being run from Intellij. The import directives are failing with the following message when I run the file.

(CompileError) seed_file.ex:24: module Ecto.Changeset is not loaded and could not be found

What do I need to do have the modules loaded before the file is run?

Thank you.

Hello @sameertj and welcome to Elixirworld,

Fellow Intellij user here. I assume your seed_file.exs is part of a Mix project. In that case, how are you running the file from Intellij? You should run it with mix run seed_file.exs so that all your project’s dependencies are loaded.

1 Like

The excellent Intellij Elixir plugin https://github.com/KronicDeth/intellij-elixir allows you to add Intellij run configurations that execute mix commands. I recommend the plugin, but I guess you’re already using it.

Thank you! That was very helpful. It worked.