Forums

TypeError: 'module' object is not callable

hi guys, I don't really know what I am doing, I am new to Python (but Senior to ABAP, haha). so I wanted to try out a trading bot that can be triggered by webhooks. My script works locally, but if I upload it to your server, I get this error:

raceback (most recent call last): ....p.py", line 34, in line_crossed
   cliente = Client(api_key, api_secret, api_passphrase, sandbox=True)
TypeError: 'module' object is not callable

I wonder what I might have done wrong. I used the bash command to install the depenceny, but I first did it wrong by using pip, not pip3.. i uninstalled the pip.. I also tried :

pip3 install --user  kucoin-python

Something that I found odd is this line:

from kucoin import Client

If I use uppercase C in Client, it errors out, but it does not error out with lowercase c. it does not error out on uppercase C in my lokal environment. When I use lowercase, I do not have a problem in the error.log, but I have a dump when executing that line above..

Any Idea where to start? My script is simple:

from flask import Flask
import json
from datetime import datetime
from kucoin import Client

app = Flask(__name__)
def line_crossed(ticker):

#demo_account in sandbox
api_key = '61db36782b968a000152e07b'
api_secret = '2784fe99-83c0-48a4-bfce-7e9aeb0b4623'
api_passphrase = 'python_1'

cliente = Client(api_key, api_secret, api_passphrase, sandbox=True)
.. plus all the magic ...

@app.route('/tradingview', methods=['POST'])
def tradingview_webhook():

line_crossed('KCSUSDT')
return ("", 200, None)

Any help is appreciated!

Check the documentation of the library that you're using to make sure that your import is correct.