I have a directory structure like this.
Chatbot/
utils/
abc.py
projects/
proj1/
utils/
__init__.py
data_process.py
components/
class1.py
I have two utils
folders in my structure, one at the top level and one inside my projects folder.
Now I want to import data_process.py
file inside class1.py
. So I tried like this
from utils.data_process import DataProcess
but it is referencing the top-level utils
folder and even VSCode is not recognizing it. I tried creating __init__.py
file inside the utils
folder but still did not work.
I tried with empty __init__.py
and then placing this content
from . import data_process
__all__ = ['data_proces']
then
from .data_process import DataPreprocess
__all__ = ['DataPreprocess']
then I tried
from ..utils.data_process import DataProcess
VSCode is recognizing this but it is not working and throws the error
ValueError: attempted relative import beyond top-level package
Even I tried changing the name utils to some other name but still the same issue
How can I solve this?