dhan = print(dhanhq(client_id, access_token)) error

Traceback (most recent call last):
File “c:\Users\Amandeep\AppData\Local\Programs\Python\Python312\sample_dhan.py”, line 5, in
dhan = print(dhanhq(client_id, access_token))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ‘module’ object is not callable

Lets say we break down what you are trying to do in two steps:
Step 1:

dhan is an object of the class dhanhq

dhan = dhanhq(client_id, access_token)
step 2:
print(dhan)
“”“”
Now this works. Because you are trying to print an object pointed to by dhan. Your typical output is - <dhanhq.dhanhq.dhanhq object at 0x108dd9f10>
“”"
The reason your statement does not work is because. 1. dhanhq is treated as a module based on your import statement. 2. print in python always returns a None.

1 Like

@Amandeep_kaur_Randha Hope your query is answered.