TypeError: 'module' object is not callable


  • Hello Experts,

    I am starting with smartapi today. I am encountering the an error : TypeError: 'module' object is not callable.

    Here is my code:

    from smartapi import SmartConnect
    import pyotp

    Create an instance of SmartConnect

    obj = SmartConnect(api_key="<Api key>")

    Generate session token

    data = obj.generateSession("S50905755", "<Pin number>", pyotp.totp("XXXXXXXXX"))

    Fetch refresh token

    refreshtoken = data['data']['refreshToken']

    Fetch feed token

    feedtoken = obj.getfeedToken()
    print(feedtoken)

    when i execute this, i get the below error:

    Traceback (most recent call last):
    File "C:/Users/thiyagu/PycharmProjects/pythonProject/stockmarket/angelone.py", line 9, in <module>
    data = obj.generateSession("S50905755", "<pin number>", pyotp.totp("XXXXXXXX"))
    TypeError: 'module' object is not callable

    Any help on this please?


  • Hi @thiyagaraaj

    Apologies for delayed response.
    Kindly consume the recent SDK of smartAPI by reinstalling.
    Please verify on the "import" to debug the "TypeError: 'module' object is not callable at this line" and share us the observation if the issue still occurs.
    https://stackoverflow.com/questions/4534438/typeerror-module-object-is-not-callable

    Thanks & Regards,
    SmartAPI team