How solve module name collision in Python?
name-collision, python
Solution
Can you nest your module in a package?
from mywebsocket.websocket import WebSocketsServer # my module
from websocket import create_connection # installed module
see https://docs.python.org/2/tutorial/modules.html#packages
Problem
I have a module named websocket. For this module I want some tests and for these tests I `pip install` the appropriate module. The problem is that the installed module has the exact same name as my own module. Project structure: ``` websocket-server | |---- websocket.py | '---- tests | '---- test.py ``` test.py: ``` from websocket import WebSocketsServer # my module from websocket import create_connection # installed module ``` Is there a way to solve this: - Without having to rename my module (`websocket.py`) - Without polluting my project with ugly `__init__()` - Needs to work both on Python3 and 2