Module object is not callable

I was trying to use plotly to plot a ohlc chart. However, it kept saying that the module object is not callable. However, with the same codes, the author was able to do it in the tutorial i followed.
Thank you!

import pandas as pd

import plotly.plotly as py
import plotly.graph_objs as go

df = pd.read_csv(“USDCAD_hour.csv”)

df.columns = [‘date’,‘open’,‘high’,‘low’,‘close’,‘volume’] = pd.to_datetime(,format="%d.%m.%Y %H:%M:%S.%f")

df = df.set_index(

df =df[[‘open’,‘high’,‘low’,‘close’,‘volume’]]

df = df.drop_duplicates(keep=False)


trace = go.ohlc(x=df.index,, high=df.high,low=df.low,close=df.close, name=‘usdcad’)



Hi @yanzifan,

Could you put your code in a fenced code block ( and include the full error message and stack trace (This usually indicates which line caused the exception).


Hi, Jmmease. thank you for your reply. I found out why i got the error. it is because my case was wrong (ohlc should be Ohlc)

1 Like

This error statement TypeError: ‘module’ object is not callable is raised as you are being confused about the Class name and Module name. The problem is in the import line . You are importing a module, not a class. This happend because the module name and class name have the same name .

If you have a class “MyClass” in a file called “” , then you should import :

from MyClass import MyClass

In Python , a script is a module, whose name is determined by the filename . So when you start out your file with import MyClass you are creating a loop in the module structure.

-- coding: utf-8 --

Editor de Spyder

@author: jackson
from sympy import symbol
from sympy import integrate
from scipy.integrate import quad

print (integrate(x3+x2+1, x))
f=lambda x:x3+x2+1