UndefinedFunctionError - seeds


I am trying to run my seeds file and have just this one line of code in seeds.exs DataFold.column_data("priv/repo/data/new_data.csv")

When I run mix run priv/repo/seeds.exs, I get this error

** (UndefinedFunctionError) function DataFold.column_data(/1 is undefined (module DataFold is not available)
    (elixir 1.14.3) lib/code.ex:1260: Code.require_file/2
    (mix 1.14.3) lib/mix/tasks/run.ex:144: Mix.Tasks.Run.run/5
    (mix 1.14.3) lib/mix/tasks/run.ex:84: Mix.Tasks.Run.run/1
    (mix 1.14.3) lib/mix/task.ex:421: anonymous fn/3 in Mix.Task.run_task/4
    (mix 1.14.3) lib/mix/task.ex:479: Mix.Task.run_alias/6
    (mix 1.14.3) lib/mix/cli.ex:84: Mix.CLI.run_task/2
    (elixir 1.14.3) lib/code.ex:1260: Code.require_file/2

Can I know what I am missing? The function is present in the DataFold module.

Is Datafold module inside the lib folder? or can you share a minimal repo to the code?

yes it is inside lib and the name of the module is Datafold. The path is lib/data_fold

Two quick questions:

  1. Can you copy and paste the defmodule line from this file?

  2. Is the file data_fold.ex or data_fold.exs ?

Found what was causing the error. It was a silly one. The file data_fold didn’t have either of the extensions ex or exs. After adding .ex, now it works. Thanks.