# Make changes in python scripts of addons effective

I am using blender with an addon called blensor. I have some trouble with this addon and would like to alter its code at some place to see the effect my changes made. Here is a working procedure:

1. Edit the appropriate python file of the addon in a text editor and save.
2. Restart blender
3. Change is visible when running addon

This however is quite tidious for debugging. It would be nice to be able to reload the addon without having to restart blender. I did some research and tried to following, with no success:

1. Pressing F8 within blender. Looking at the console I can see that blensor seems to be reloaded but the changes I made are not visible when running it. Maybe the output "addon_utils.disable: cycles not disabled" in the system console means something?
2. Opening the python script in blender's text editor, changing and saving it and clicking Text -> Reload. Does not seem to have any effect.

Any other ways or idea what I am missing?

• F8 should be working, are you sure you edited the script file in the right location? In certain cases, it is unavoidable to restart Blender, see developer.blender.org/T37021 – CoDEmanX Jul 23 '14 at 10:25
• @CoDEmanX: Well, pretty sure, since the change I make is applied once I restart blender. As for your link: What I could identify as interesting was "As for F8, it is only designed to reload installed addons/ui scripts/etc., not any kind of random py file.". I think that blensor is an addon since I can disable it using bpy.ops.wm.addon_disable. When I browse under user preferences -> addons I cannot find it however....(edit, for reference: blensor.org) – user1809923 Jul 23 '14 at 13:35
• It is an addon and should actually be listed somewhere in User Preferences > Addons. The reason why F8 doesn't work appears to be the missing support for it in the code: __init__.py imports the scripts from the same folder, but doesn't handle reloads (see e.g. io_scene_fbx/__init__.py, search for all occurrences of import_fbx for an example of proper import). – CoDEmanX Jul 23 '14 at 16:10

I am the author of the blensor addon.

I used the tip from CoDEmanX and just implemented the reload functionality in the blensor module.

If you have an older blensor version and don't want to compile it from source you can manually add it by changing the file __init__.py

Everything above __version__ has to be changed to

import sys
import traceback
from mathutils import Matrix
from math import pi
import types
import bpy

import blensor.blendodyne
import blensor.depthmap
import blensor.tof
import blensor.evd
import blensor.ibeo
import blensor.generic_lidar
import blensor.kinect
import blensor.exportmotion
import blensor.mesh_utils
import blensor.noise