This is my folder structure:
script.py
api/
__init__.py
charts/
__init__.py
charts.py
In script.py
, I have:
from api.charts import charts
import billboard
and the call:
charts('Alternative-Songs', '1997')
billboard.py
is not in the above structure because it was installed on my system via python setup.py install
, and it has the methods for charts()
, like so:
billboard.ChartData(chart_name, date)
at charts.py
, charts()
was defined using a billboard.py
method:
def charts(chart_name, date):
chart = billboard.ChartData(chart_name, date, quantize=True)
return chart
but when I run script.py
, I get the following error:
Traceback (most recent call last):
File "script.py", line 70, in <module>
print (charts('Alternative-Songs', '1997'))
TypeError: 'module' object is not callable
How do I fix this?