I'm building a module that contains only functions, which I named functions.py, it's in the same directory as the addon's __init__.py file. So I have various solutions:

Solution 1:

from . import functions

Now I can call the functions contained in functions.py module like so:


Solution 2:

from .functions import *

Now I can call functions like this:


I particularly like the use of the second solution (But I don't know which is the best idea)

Anyway the question is: when I run bpy.ops.script.reload() Changes made inside functions.py module will not be reloaded, Only by restarting Blender will these take effect.

So I'd like to understand how to go about solving Solution 1 and 2

I want to clarify that I ask this, as it is quite frustrating to have to restart the blender at every minimum change of the modules.

  • 1
    $\begingroup$ from xxx import * isn't recommended, can lead to problems down the road. you could use import functions as f to make the first solution shorter to write $\endgroup$
    – pevinkinel
    Sep 29, 2020 at 10:03
  • $\begingroup$ Hello @wilks I really appreciate the comment, and would love to know why you suggest this. I still don't have the skills to fully understand this (Unfortunately) $\endgroup$
    – Noob Cat
    Sep 29, 2020 at 12:11
  • 1
    $\begingroup$ Importing * in Python. | Medium. This post explained well, basically it's fine if you know exactly what is imported inside your code. But most of the time, write out them explicitly will be better since most of the packages/modules you used are not written by you. And also, after a month, you will forget what you have written in your functions.py. $\endgroup$
    – HikariTW
    Sep 29, 2020 at 12:58
  • $\begingroup$ @HikariTW Sounds cool, you convinced me to avoid using solution 2, this makes a lot of sense. $\endgroup$
    – Noob Cat
    Sep 29, 2020 at 14:26
  • 1
    $\begingroup$ blender.stackexchange.com/a/158787/15543 $\endgroup$
    – batFINGER
    Oct 8, 2020 at 22:21

1 Answer 1


It is not that bad to use the second method if you're not collaborate and distribute your project with other. In other words, personal usage is fine if you do take care of naming confliction.

The problem when you reload script is a common mistake that you assume that all object you imported from that module is reloaded by the reload method (imp.reload()). Instead reload all relative script, Python will only reload the required script, which is your module, not the * objects.

You can some how use Python built-in reload function to specify the updated script that you want to use and reimport * again:

from imp import reload
reload(function)  # bpy.ops.script.reload() seems like a sugar macro that handle the dependencies

from functions import *
# This is required since you don't reload e.g. `foo()` and `bar()` in your functions

And also if you want to use Method 1 for correctness:

from . import functions as fn


# You should take care about relative import path issue
from ./functions import (
  • $\begingroup$ each time you reload any module, the from import objects need to be reassign again to update its content $\endgroup$
    – HikariTW
    Sep 29, 2020 at 10:52
  • $\begingroup$ Ok,sounds cool, but I don't understand how I have to organize, at the beginning of the script, this, so that I can reload everything using bpy.ops.script.reload() . I decided to use my solution 1, as it actually seems much more reliable, so as not to create possible conflicts of variables. $\endgroup$
    – Noob Cat
    Sep 30, 2020 at 11:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .