I am trying to call a function that live in a sibling folder from the script that I run:
in folder-B/B.py:
def methodB():
return "\n\nThis is methodB from Folder-B"
in folderA/A.py:
import sys
sys.path.append("..")
from folder-B.B import methodB
s = methodB()
print(s)
When calling python A.py
I get error:
File "A.py", line 3 from folder-B.B import methodB ^ SyntaxError: invalid syntax
folderA and folder-B are at the same folder level.
I know the problem comes from the dash, but I could not find any solution to keep the folder name with a dash
Any idea ?