A python package to import files from an adjacent folder

Overview

EasyImports

About

EasyImports is a python package that allows users to easily access and import files from sister folders:
f.ex:

- Project
    - Folder 1
        -main.py
    - Folder 2
        -userpackage1.py
        -other_stuff.py
    - My Folder 
        -important_package.py

if you would try to import anything in main.py that isn't in Folder 1 you'll get an error.
F.ex:

in main.py

import userpackage1
from Folder 2 import other_stuff.py
import My Folder.important_package.py

=> Each of these will raise a ModuleNotFoundError
With EasyImports this can be fixed.

Installing

To install EasyImports:

pip install EasyImports

Loading Imports

Inside main.py, type the following code:

from EasyImports import easyimports
easyimports.loadImports()

Now, you can just import the files userpackage1.py, other_stuff.py and important_package.py like you would normally:

#import EasyImports and load sister files
from EasyImports import easyimports
easyimports.loadImports()

#import files
import userpackage1
import other_stuff
import important_package

#alternatively, you can also do
import userpackage1, other_stuff, important_package

Pylance error

Sometimes, Pylance can raise a warning: Import "package" could not be resolved
this isn't problematic, as the program will still run without issues, but it may be visually annoying
you can fix this by ignoring the Pylance error:

#import EasyImports and load sister files
from EasyImports import easyimports
easyimports.loadImports()

#import files and ignore warning 
import userpackage1 #type: ignore
You might also like...
Zero configuration Airflow plugin that let you manage your DAG files.
Zero configuration Airflow plugin that let you manage your DAG files.

simple-dag-editor SimpleDagEditor is a zero configuration plugin for Apache Airflow. It provides a file managing interface that points to your dag_fol

In this Github repository I will share my freqtrade files with you. I want to help people with this repository who don't know Freqtrade so much yet.
In this Github repository I will share my freqtrade files with you. I want to help people with this repository who don't know Freqtrade so much yet.

My Freqtrade stuff In this Github repository I will share my freqtrade files with you. I want to help people with this repository who don't know Freqt

Parser manager for parsing DOC, DOCX, PDF or HTML files

Parser manager Description Parser gets PDF, DOC, DOCX or HTML file via API and saves parsed data to the database. Implemented in Ruby 3.0.1 using Acti

epub2sphinx is a tool to convert epub files to ReST for Sphinx
epub2sphinx is a tool to convert epub files to ReST for Sphinx

epub2sphinx epub2sphinx is a tool to convert epub files to ReST for Sphinx. It uses Pandoc for converting HTML data inside epub files into ReST. It cr

An open source utility for creating publication quality LaTex figures generated from OpenFOAM data files.

foamTEX An open source utility for creating publication quality LaTex figures generated from OpenFOAM data files. Explore the docs » Report Bug · Requ

Read write method - Read files in various types of formats

一个关于所有格式文件读取的方法 1。 问题描述: 各种各样的文件格式,读写操作非常的麻烦,能够有一种方法,可以整合所有格式的文件,方便用户进行读取和写入。 2

Compare two CSV files for differences. Colorize the differences and align the columns.
Compare two CSV files for differences. Colorize the differences and align the columns.

pretty-csv-diff Compare two CSV files for differences. Colorize the differences and align the columns. Command-Line Example Command-Line Usage usage:

Make posters from Markdown files.
Make posters from Markdown files.

MkPosters Create posters using Markdown. Supports icons, admonitions, and LaTeX mathematics. At the moment it is restricted to the specific layout of

The sarge package provides a wrapper for subprocess which provides command pipeline functionality.

Overview The sarge package provides a wrapper for subprocess which provides command pipeline functionality. This package leverages subprocess to provi

Releases(v0.0.2)
Owner
null
A python package to avoid writing and maintaining duplicated python docstrings.

docstring-inheritance is a python package to avoid writing and maintaining duplicated python docstrings.

Antoine Dechaume 15 Dec 7, 2022
Run `black` on python code blocks in documentation files

blacken-docs Run black on python code blocks in documentation files. install pip install blacken-docs usage blacken-docs provides a single executable

Anthony Sottile 460 Dec 23, 2022
A Python module for creating Excel XLSX files.

XlsxWriter XlsxWriter is a Python module for writing files in the Excel 2007+ XLSX file format. XlsxWriter can be used to write text, numbers, formula

John McNamara 3.1k Dec 29, 2022
VSCode extension that generates docstrings for python files

VSCode Python Docstring Generator Visual Studio Code extension to quickly generate docstrings for python functions. Features Quickly generate a docstr

Nils Werner 506 Jan 3, 2023
Loudchecker - Python script to check files for earrape

loudchecker python script to check files for earrape automatically installs depe

null 1 Jan 22, 2022
python package sphinx template

python-package-sphinx-template python-package-sphinx-template

Soumil Nitin Shah 2 Dec 26, 2022
Pyoccur - Python package to operate on occurrences (duplicates) of elements in lists

pyoccur Python Occurrence Operations on Lists About Package A simple python package with 3 functions has_dup() get_dup() remove_dup() Currently the du

Ahamed Musthafa 6 Jan 7, 2023
A Python Package To Generate Strong Passwords For You in Your Projects.

shPassGenerator Version 1.0.6 Ready To Use Developed by Shervin Badanara (shervinbdndev) on Github Language and technologies used in This Project Work

Shervin 11 Dec 19, 2022
An MkDocs plugin to export content pages as PDF files

MkDocs PDF Export Plugin An MkDocs plugin to export content pages as PDF files The pdf-export plugin will export all markdown pages in your MkDocs rep

Terry Zhao 266 Dec 13, 2022
sphinx builder that outputs markdown files.

sphinx-markdown-builder sphinx builder that outputs markdown files Please ★ this repo if you found it useful ★ ★ ★ If you want frontmatter support ple

Clay Risser 144 Jan 6, 2023