Need help with multiple file add on?

How do you set up a multiple file addon? Tried placing all the other .py files in a separate folder and also in the same folder as the int File ,but I can get it to enabled in blender cause it won’t pick up the other files. Right now I’m getting a parent module not loaded error cannot perform relative import.

Found this example code online ,but is doesn’t do anything. (operators and ui was the other .py files in this example.It was also in the same folder as the int)
Tried similar setups that I looked at in other addons ,but still doesn’t do anything.

if "bpy" in locals():
    import imp
    if "ui" in locals():
        imp.reload(ui)
    if "operators" in locals():
        imp.reload(operators)

import bpy
from . import ui
from . import operators

You need to define the bl_info dictionary as well, also note that the imp module is deprecated.


bl_info = {
    "name": "My Script",
    "description": "Single line explaining what this script exactly does.",
    "author": "John Doe, Jane Doe",
    "version": (1, 0),
    "blender": (2, 65, 0),
    "location": "View3D > Add > Mesh",
    "warning": "", <i># used for warning icon and text in addons panel</i>
    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
                "Scripts/My_Script",
    "tracker_url": "http://developer.blender.org/maniphest/task/create/?project=3&type=Bug",
    "support": "COMMUNITY",
    "category": "Add Mesh"
    }

https://wiki.blender.org/index.php/Dev:Py/Scripts/Guidelines/Addons

Yes, I have the bl_info in my addon.

This is from MakeWalk addon in the MakeHuman category.Of course the word after import is all the other .py files. It also has panel code in the int.py and my setup is similar to this. If I add everything from this line down (# To support reload properly, try to access a package var, if it’s there, reload everything) and rename everything to what my other .py files are I can’t get it enabled in blender. If I remove all that from my file, it will enable ,but of course there is nothing from my other .py files.

This is my first time trying to do a multiple file addon and from looking at several that I have installed I can’t figure out what I’m missing. I know everything works, cause I can load everything in blender and hit run script and it works. I could prolly get it to work by putting all in one .py file(and I might have to do that) ,but it’s a lot. If anybody want to look at it, I’ll see if the forum will let me upload a zip file.

bl_info = {
    "name": "MakeWalk",
    "author": "Thomas Larsson",
    "version": (0, 943),
    "blender": (2, 6, 9),
    "location": "View3D &gt; Tools &gt; MakeWalk",
    "description": "Mocap tool for MakeHuman character",
    "warning": "",
    'wiki_url': "http://www.makehuman.org/doc/node/makewalk.html",
    "category": "MakeHuman"}

# To support reload properly, try to access a package var, if it's there, reload everything
if "bpy" in locals():
    print("Reloading MakeWalk v %d.%d" % bl_info["version"])
    import imp
    imp.reload(utils)
    imp.reload(io_json)
    imp.reload(props)
    imp.reload(t_pose)
    imp.reload(armature)
    imp.reload(source)
    imp.reload(target)
    imp.reload(load)
    imp.reload(retarget)
    imp.reload(fkik)
    imp.reload(simplify)
    imp.reload(action)
    imp.reload(loop)
    imp.reload(edit)
    imp.reload(floor)
else:
    print("Loading MakeWalk v %d.%d" % bl_info["version"])
    import bpy, os
    from bpy_extras.io_utils import ImportHelper
    from bpy.props import *

    from . import utils
    from . import io_json
    from . import props
    from . import t_pose
    from . import armature
    from . import source
    from . import target
    from . import load
    from . import retarget
    from . import fkik
    from . import simplify
    from . import action
    from . import loop
    from . import edit
    from . import floor