Come again? This is what "import" does, obviously. This is not a clear explanation of your problem.
I say script here because the apparent intention is that scripts and modules are separate. That is why it's not easy to import functions from a file in the same directory as a script.
This restriction is very unexpected. And it is not borne out well by the fact that it is not obvious this distinction exists.
When you run a module, the root package containing it is on the path by definition and imports work.
Does that still work if you call the script from a different directory (so `python bar/foo.py`)?
Imma guess it doesn't work with symlinked scripts. But I don't think it should without doing an install, in which case a module does make sense.
I don't think Python will resolve symlinks here, so if that needs to work, you probably need to do it yourself before touching other code / files.
This is not supported in python. For reasons beyond my understanding, you are supposed to put the script with python, or with the shebang, in a different directory.
Alternatively, you can always use `python -m` to run your code.