Python relative-import script two levels up Python relative-import script two levels up python-3.x python-3.x

Python relative-import script two levels up


To access script_c and script_b from script_a, you would use:

from ...folder_3 import script_cfrom . import script_b

Or if you use python3, you can import script_b from script_a by just using:

import script_b

However, you should probably use absolute imports:

from mypackage.folder_3 import script_cfrom mypackage.folder1.folder2 import script_b

Also see: Absolute vs Relative imports