Subfolder issue

Seems to be the only fix yet in other IDEs its not a issue to use subfolders. Some help would be nice.

This error occurs because Python can’t find the Classes module in its path. This is likely because the project’s root directory isn’t in the Python path. There are a few ways to fix this:

  • Add an empty init.py file in the Classes directory to make it a proper Python package:

init.py(new)

Empty file to make Classes a Python package

  1. Modify the import statement to use relative imports. Since TestCollection.py is in the Debugging directory, you need to go up one level to access Classes:

TestCollection.py

Apply

from …Classes.Class_Data_Module import DataModule

  • The most reliable solution is to modify your Python path to include the project root. Add this at the start of your script:

TestHistoricaldataCollection.py

Apply

import sys

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(file))))

import os

from Classes.Class_Data_Module import DataModule

I recommend option 3 as it’s the most explicit and reliable solution. This will add the project root directory to Python’s path, allowing it to find the Classes module.

folder structure
-Project
__Classes
—Class_Data_Module.py
–Debugging
—TestCollection.py