Skip to main content

Relative imports that actually work

Project description

Install

pip install python-include

Use

import python_include

# import [name] from-anywhere (doesnt pollute global namespace)
hello = python_include.file("./path/to/file/with/hello/func/code.py", {"__file__":__file__}).hello
hello()

# import [*everything*] from-anywhere (does pollute global namespace)
python_include.file("./path/to/file/with/hello/func/code.py", globals())
hello() # function that was defined inside that^ "code.py"

Project details


Download files

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

Source Distribution

python_include-2.0.0.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

python_include-2.0.0-py3-none-any.whl (5.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page