The location of the mod files isn't important; the location of the dll (OS X or MSWin) or special that is produced by compiling the mod files is what matters.

For example, suppose I use Linux and the foo.hoc or foo.py that I want NEURON to execute is in a directory called model1. I'd cd to model1, then in that directory I'd execute
nrnivmodl /ext/dir
which would compile the mod files that are in /ext/dir and produce an i686 or x86_64 subdirectory in model1 that contains a file called special. Staying in model1 and using nrngui or nrniv to execute foo.hoc or foo.py will make NEURON automatically discover and load the compiled mechanisms. If I then cd to some other directory, say model2, where there is a foo.hoc (or foo.py) that I want to use with the same compiled mechanisms, in model2 I could execute
model1/i686/special foo.hoc -
which would make NEURON load the compiled mechanisms and execute foo.hoc
or
model1/i686/special foo.hoc
which would make NEURON load the compiled mechanisms, execute foo.hoc, then exit.

If you're using MSWin or OS X, it should be sufficient to just run mknrndll in /ext/dir where the mod files are, and then copy the resulting nrnmech.dll file to wherever your foo.hoc or foo.py is located. Or you could leave the nrnmech.dll wherever you generated it, and just specify the path to it on the command line when you launch NEURON as an option to the -dll switch, like so
nrniv -dll /path/to/nrnmech.dll foo.hoc
with the optional - at the end if you don't want NEURON to exit immediately after it executes foo.hoc

If you know where the shared library is, then you can load if from hoc using
nrn_load_dll("/where/the/shared/library/is/libnrnmech.so")
on a linux or mac machine that location is generally ./x86_64/.libs/libnrnmech.so
on mswin it is generally ./nrnmech.dll