Arbaz Siddiqui
Arbaz Siddiqui

Reputation: 481

How to import module from the parent directory of my parent folder?

Presently I have a directory structure like :

A
  myscript.py
B
C
 D
  module.py

I want to import module into my script, what is the best way to do this.

Upvotes: 1

Views: 694

Answers (1)

xXliolauXx
xXliolauXx

Reputation: 1313

Simply add an empty __init__.py to C and D, and then:

import C.D.module

Upvotes: 3

Related Questions