Python How to import a module from a parent path for GA?

I played around with this a bit and this my simples solution:

import os, sys
parentPath = os.path.abspath("..")
if parentPath not in sys.path:
    sys.path.insert(0, parentPath)

from TestModule import TestMethod

TestModule is a python file in the parent folder of the script.

1 Like