Trying to split script up across more then one file

I have two files …

def showsomething():
	print("this is")


print("this is file")

How on earth do I get to use the code in

Heh, figured it out…

import sys
import os
import bpy

blend_dir = os.path.dirname(
if blend_dir not in sys.path:

import b
import imp

lets test see b

Is there a better way/proper way of doing this? - what I found does not feel clean!

I would like to code this python script in an external editor and spread it across a number of files for ease of development.

That’s pretty much how it’s done… aside from the imp.reload part which is totally not needed.

You can also take a look at ‘modules’ on the docs.

imp.reload() is there so blender does not keep hold of the external file I might be changing

this is my solution
chanbe so:

import b
print("this is file")

Running gives:
this is file
this is


def yada():

with blah in modules folder:

from blah import yada

with blah in same folder (init perhaps):

from .blah import yada