Julia cannot find the module file in the same directory of the main file

Hi all,

I have script named “main.jl” that uses a module written by me named “PmFunc.jl”. I call PmFunc module within main.jl using "using PmFunc. Both of these files are in the same folder. To make sure that the folder is in the path I do

(pwd() in LOAD_PATH) ? print("working directory is in the path") : push!(LOAD_PATH,pwd())

in the begining of main.jl file.

Here is my weird problem. Everything works fine when I run the main.jl file that uses functions within PmFunc.jl. However, if I copy and paste the entire folder to somewhere else, I keep getting the following error.

LoadError: ArgumentError: Package PmFunc not found in current path: Julia

I have a feeling that this is somehow related to Project.toml, but I do not know why. I am a Julia newbie. Any help is appreciated.

pwd() tells you where you are when you invoke julia, not where the program file is. You might just want to include() the file if you’re using it this way.

Thank you for your reply, however, pwd() does return where the file is. Neverthless, I deleted the aux. files in the folder restarted everything it somehow worked.

pwd() does return where the file is

Not in my world:

lee@tctmp0:pwd                                                                                                                          
/tmp
lee@tctmp0:cat where_am_I.jl 
println(pwd())
lee@tctmp0:cd /                                                                                                                         
lee@tc/0:julia /tmp/where_am_I.jl                                                                                                       
/