Inheritance AttributeError: 'module' object has no attribute

I have a pycharm project with two .py files signal.pyand moving_average.py.

signal.py It looks something like this:

class signal_class(object):

    long_short = 0
    underlying = ""
    def abc(self,...):

and moving_average.pylooks something like this:

import signal
import stock_wrapper
import pandas as pd
import signal

class SMA(signal.signal_class): #Error throws here.

    df = None
    s_w = None

Which looks right for me, but when I try to start, I get the following error:

    class SMA(signal.signal_class):
AttributeError: 'module' object has no attribute 'signal_class'

The error is displayed from the linear market above.

I thought I was closely following the textbook, but I'm not sure what causes this.

Thanks so much for anyone who can help with this.

+4
source share
1 answer

Python has a built-in package called signal

So when you import import signal.

signal_class - signal.py,

from .signal import signal_class

SMA

+2

Source: https://habr.com/ru/post/1627892/


All Articles