this code is get the templates/blog1/page.html in b.py:
path = os.path.join(os.path.dirname(__file__), os.path.join(\'templates\', \'blog1/page.html\'))
Use relative path with the pathlib module in Python 3.4+:
from pathlib import Path Path(__file__).parent
You can use multiple calls to parent to go further in the path:
parent
Path(__file__).parent.parent
As an alternative to specifying parent twice, you can use:
Path(__file__).parents[1]