Python does not tell me which line an undefined function is in

This clarfies things. The reason you didn’t see a traceback with the line number of the error is because you’re catching (suppressing) the exception instead of letting it propagate up to the default handler. Just printing the exception object only shows you the object’s repr, not the full traceback. (If for whatever reason you want to generate a formatted traceback for an exception object, you can use the tools in traceback).

Generally, it’s not a great idea to catch an exception unless one of the following is true:

  1. You want to raise a more specific exception that provides additional information about what went wrong
  2. You want to perform some action before letting the exception continue to propagate (e.g. closing resources, logging)
  3. You know exactly how to recover from it or otherwise know that its innocuous (obligatory Zen: In the face of ambiguity, refuse the temptation to guess)

Catching exceptions prematurely (especially if only to print a message and exit) has the effect of discarding information that could be useful for debugging. Note that the stack trace for an exception is built up as the exception bubbles up through the call stack, so the further you let an exception propagate, the more information you’ll have about where your program was at the time the exception was raised.

There’s some more discussion on when to catch exceptions in this related thread:

If you have virtual environments for your different projects, probably the easiest thing to do would be to install your library in each one. That should be as simple as adding a minimal pyproject.toml and then running

pip install -e 'c:/users/USERNAME/Pycharmprojects/ggutil2024'

once for each virtual environment. Note the -e flag for editable mode, which more-or-less just permanently appends c:/users/USERNAME/Pycharmprojects/ggutil2024 to the virtual env’s import path.

You could also add c:/users/USERNAME/Pycharmprojects/ggutil2024 as a path dependency in your other projects’ pyproject.toml files.