Put your functions in .zshenv. .zshenv is sourced on all invocations of the shell, unless the -f option is set. It should contain commands to set the command search path, plus other important environment variables. .zshenv should not contain commands that produce output or assume the shell is attached to a tty. .zshrc is sourced in interactive shells. It should contain commands to set up aliases, functions, options, key bindings, etc.