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 ?
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
CodePudding user response:
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.