Relative Content

Tag Archive for pythonpython-import

Importing functions from another directory

I’m currently working on a personal project in Python where I have many different packages to organize different pieces of similar code together. I’ve come into a situation where I need to access a piece of code from a different directory, but run into errors when I try running the code from the terminal. (Windows Command Prompt)

How to import functions into main.py from subfolders like a professional python developer?

I am working on a large project in VS code. I have various subfolders with plenty of .py files. Then I have a main.py in the main folder. I want to import various functions form various files that exist in different subfolders. I find “from * import *” very redundant process. What is the efficient way to do it? Or how does a professional python developer does it?