Rafa_izu
Rafa_izu

Reputation: 85

How to import a module from Python

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!

Upvotes: 0

Views: 58

Answers (1)

Chance
Chance

Reputation: 488

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

Upvotes: 1

Related Questions