I\'m trying to make changes to an existing python module, and then test it locally. What\'s the best way to do this?
I cloned the github module and made changes, but I\'
One way consists in using sys.path().
For example:
import sys
sys.path.insert(0, path/to/module)
In this way, you give priority to a specific path when looking for a module.
This means that the module you want to import will be searched first in path/to/module
and after in the other directories already in sys.path
.
The advantage of this approach is that this new order will hold only inside your script without changing the import order of the other ones.
Note: For development purposes you should use a virtualenv as suggested by @eandersson.