Let's add a local_file_path() function so that we can sfid = fs.sfload(local_file_path("example.sf2")) reliably no matter which directory we are in.
def local_file_path(file_name: str) -> str:
"""
Return a file path to a file that is in the same directory as this file.
"""
from os.path import dirname, join
return join(dirname(__file__), file_name)
Let's add a
local_file_path()
function so that we cansfid = fs.sfload(local_file_path("example.sf2"))
reliably no matter which directory we are in.