Python with visual studio code, imports own modules stop working without any reason

Question:

Currently, I’m working on a small college project.
Today I created small layered structure, and everything working fine, i created some small python modules in separate files, and next to it, I use these modules and their methods in other python files. Everything looks and works fine, and i save my progress and close VS Code.

After few hours I’m back to coding with this horrible env, and I find that’s my imports stop working, without any logical reason, I don’t perform any changes to my code before and after I close vs last time. I tried some online solutions, but none works for me, as well as I’m a .net developer and a situation like this is a little weird for me.

Anyone had same or similar issue with python ?

Fragment of structure:
enter image description here

Code:

ThrowHelper.py:

class appError(Exception):
    def __init__(self, message) -> None:
        self.message = message

CommonFileModule.py:

import pandas as pd
import helpers.ThrowHelper as throw
import core.Shared as core

def readCsvFile(path: str, **separator: str):
    try:
        file = open(path, "rt")
        file.close()
        data = pd.read_csv(file, separator)
        return data
    except FileNotFoundError:
        throw.appError(core.AppErrorCodes.FileDoesntExist)
        return None

ErrorCode:
enter image description here

Asked By: Overcode

||

Answers:

It seems to me that you should import full import paths e.g.

from common.helpers.ThrowHelper import appError as throw

I tested it and it worked for me.

Answered By: Giggest
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.