I am a newbie, and picking up Python (3.4) and trying to work on classes.
I have created a module BootstrapYieldCurve, with two classes (BootstrapYieldCurve and ForwardRates) inside.
When I import the module, I can call and manipulate the BootstrapYieldCurve class, but I get an error from calling the ForwardRates class.
Would someone be able to advise if the code is wrong, or the way I call the class in Python Shell?
>>> from BootstrapYieldCurve import ForwardRates
>>> Traceback (most recent call last):
File "<pyshell#36>", line 1, in <module>
from BootstrapYieldCurve import ForwardRates
ImportError: cannot import name 'ForwardRates'
This is my module code structure
import math
class BootstrapYieldCurve():
def __init__(self):
def add_instrument(..........):
..........
class ForwardRates():
def .........
ForwardRatesclass? Modules are cached, if you added new things, thatimportwon't work unless you do:from importlib import reload,import BootstrapYieldCurve,reload(BootstrapYieldCurve), then repeat yourfrom x import ystatement.