Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import module from path #15

Open
chendaniely opened this issue Jul 23, 2020 · 1 comment
Open

Import module from path #15

chendaniely opened this issue Jul 23, 2020 · 1 comment

Comments

@chendaniely
Copy link
Owner

From here: https://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path

we can actually import module files from a full python path. Since here() will return a full path, we can write a function that makes it easier to import.

I don't want to name the function import, but something like:

import pyprojroot

# will append `src` to the import path (temporarily)
pyprojroot. proj_import(here("./src"))` 
import my_module1
import my_module2

# will import module directly, given a .py script
pyprojroot. proj_import(here("./src/my_module.py"))` 
@jamesmyatt
Copy link
Contributor

I don't think this is in scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants