bank
__init__.py
Account.py
SavingAccount.py
main.py
The SavingAccount class is inherit from Account(abstract class). When main.py import SavingAccount as below:
from bank.SavingAccount import SavingAccount
It appear "No module named 'Account'". Could someone know how to solve it?
The complete error code in output window as below:
Traceback (most recent call last):
File "main.py", line 5, in <module>
from bank.SavingAccount import SavingAccount
File "\bank\SavingAccount.py", line 1, in <module>
from Account import Account
ModuleNotFoundError: No module named 'Account'
Acccount.py
from abc import ABCMeta,abstractmethod
class Account(metaclass=ABCMeta):
_id = 0
_name = ''
_balance = 0
__next = 0
def __init__(self,name,initBal = 1000):
self._name=name;
self._balance = initBal
SavingAccount.py
from Account import Account
class SavingAccount(Account):
_interestRate = 0
def __init__(self,name,initBal=0):
super(SavingAccount,self).__init__(name,initBal)
@classmethod
def interestRate(cls):
_interestRate = 0
@classmethod
def interestRate(cls,rate):
cls._interestRate = rate