using myPkg traverses traverses through LOAD_PATH and searches the folders listed to see if it can find such a package. There are some default paths as you can see, e.g. "@v#.#" that tells the pkg system to look into the Project.toml file of the v#.# environment and see if it can find an entry to your package there. The package system does not consider pwd() as a directory where the package could be located by default, so thats why you had to push to LOAD_PATH. I don’t think this is really a good approach unless you are familiar with the Julia package/environment system.
There are two alternative ways. First the more canonical way would be to use dev.
(@v1.4) pkg> dev mypkg
Path `/home/affan/.julia/dev/mypkg` exists and looks like the correct package. Using existing path.
Resolving package versions...
Updating `~/.julia/environments/v1.4/Project.toml`
[c6683dd1] + mypkg v0.1.0 [`~/.julia/dev/mypkg`]
Updating `~/.julia/environments/v1.4/Manifest.toml`
[c6683dd1] + mypkg v0.1.0 [`~/.julia/dev/mypkg`]
julia> using mypkg
[ Info: Precompiling mypkg [c6683dd1-c332-45c4-be08-9497673428c9]
julia>
So by dev’ing the package, it adds an entry to your Project.toml file with the package information (see ] st to see the dev’ed package info). This will let you run using mypkg regardless of your pwd. Note the entry for the dev’ed package is added to the Project file of the currently active environment.
The second way would be to manually include the file that defines the package module.
include("file_that_defines_mypkg.jl") # often just myPkg.jl
using .myPkg