0

I'm trying to import a class called dataFrame from a script called dataFrame.py that is in the same folder of the script that I'm trying to import it that is called Cutoff. When I'm trying to import it I got this message:

"ModuleNotFoundError: No module named 'modules'"

this how my project is organized:

Project
└───modules
    │
    └───planilhas
        └───components
                cutoff.py
                dataFrame.py
                gko.py
                gko_24.py
                gko_25.py

This how I trying to import it:

from modules.planilhas.components.dataFrame import DataFrame
import pandas as pd # pandas has no problem to be imported, ignore it

class Cutoff(DataFrame):
    pass

Where is the problem of my code? How do I import modules from Python in the right way? Please, can someone give me a hand? Thanks!

2
  • To import package it needs to have a __init__.py. On all levels. Commented Feb 15, 2021 at 20:36
  • If you're trying to import it from cutoff.py which is in the same directory, then try from dataFrame import DataFrame. Commented Feb 15, 2021 at 20:36

1 Answer 1

1

Since it's in the same folder, try just from dataFrame import DataFrame

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.