I am new in Python programming. I have property consist of getter and setter in a class in file A.
class Histogram: def getHue(self): return self.value def setHue(self, value): self.varHueHist = value HueHist = property(getHue, setHue) I want to access the property from another class in another file which is file B. But after I import the file A and the class inside the file B, the property still can not be accessed.
from Histogram import Histogram class moment: var = Histogram() The property cannot be accessed. When i tried to use automatic completing (Ctrl+space) in my Spyder, the property also didn't show. Unfortunately, when i tried to access the property inside class in the same file with the property, the property is readable. How to call property from inside class in another file?
Both of the files are already in the same folder. Please help. Thanks
from filename import class_namefor my codepropertyis completely pointless. You should just use a regular attribute, because your getter and setter do nothing.property Huethat wil get the number of Bin used for making histogram. So when i call it from another class it will be like this, first I make instance class and store it in a variable:CandidateHistogram = Histogram()and then i call the property to make histogram like this:CandidateHistogram.HueHist(20). I want to create histogram by calling the statement like that.