Skip to main content

Make it easy to import the modules in parent directories

Project description


Make it easy to import the modules in parent directories

released version license

If you want to solve ValueError: attempted relative import beyond top-level package, DotDot may be helpful for you.


If it can be installed and imported successfully, it should work correctly.

Install via pip:

pip install dotdot

Quick Start

Consider a common project structure as following:

    ├── foo
    │    ├──
    │    └──

Now, can import those utils by importing dotdot first. Like this:

import dotdot
import foo.util
import util

Moreover, you can import the modules in grandparent or even great grandparent directory by importing dotdotdot or dotdotdotdot first.

How It Works

DotDot does this magic by changing sys.path[0] in import time.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dotdot, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size dotdot-1.1.0.tar.gz (3.5 kB) File type Source Python version None Upload date Hashes View
Filename, size dotdot-1.1.0-py2.py3-none-any.whl (8.0 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page