ImportError: cannot import name 'SmartWebSocket' from partially initialized module 'smartapi' (most likely due to a circular import)
Asked
Active
Viewed 448 times
0
-
This error means that you are doing circular imports. The general solution is to extract shared functionality to another file/module or (if possible) move import to function body. [See this for reference](https://stackoverflow.com/questions/22187279/python-circular-importing) – STerliakov Feb 07 '22 at 09:29
-
1This is happening because `smartapi` is importing from a module that itself does `import smartapi`. That is what a *circular import* means. The line numbers in the stack trace, which you have not included in your question (*why not?*) will point you to the exact lines in the two modules that are causing the problem. – BoarGules Feb 07 '22 at 09:40
-
The issue was solved. The name of the file was a issue (websocket.py) I was importing the smartSocket package which in turn was importing websocket package. – Dhruvit Feb 08 '22 at 12:15