I used pathlib
to add my module directory to my system path as I wanted to avoid installing the module as a package and @maninthecomputer response didn't work for me
import sys
from pathlib import Path
cwd = str(Path(__file__).parent)
sys.path.insert(0, cwd)
from my_module import my_function