No module named Error when importing from another file in an addon So I have an error which is when I try to import my entire add on as a zip file and enable it, it gives me an error saying there is no module named &quot;save_shader_map&quot;.
I know this isn't true because I have structured my add on as a folder. In the folder there are three files, init.py, load_shader_map.py and save_shader_map.py and I can see there is a file called save_shader_map.py in the same folder.
Where I am trying to import the save_shader_map python file is in another file in my addon named load_shader_map.py and the relevant code is here:
#import all libraries including re needed for regex matching
#import Path library to search recursively for files
import bpy, re
import glob
from pathlib import Path


import os

#import from other files required functions and classes
import sys

sys.path.append(&quot;.&quot;)
#import classes
from save_shader_map import SHADER_PRESETS_UL_items, ShowMessageOperator
#import functions
from save_shader_map import get_preferences, get_selected_folder_presets, json_to_nodes_dict


Now I think the problem is with the sys.path.append(&quot;.&quot;), because the line where the error of no module found occurs is this line:
from save_shader_map import SHADER_PRESETS_UL_items, ShowMessageOperator

I have tried instead replacing the sys.path.append with the following code which still says there is no module named save_shader_map, so I believe I am importing it incorrectly.

from . import save_shader_map

#import classes
from save_shader_map import SHADER_PRESETS_UL_items, ShowMessageOperator
#import functions
from save_shader_map import get_preferences, get_selected_folder_presets, json_to_nodes_dict

My _init file looks like this:
from . import save_shader_map
from . import load_shader_map
import time
import bpy

bl_info = {
    &quot;name&quot;: &quot;UE Shader Map Setups&quot;,
    &quot;author&quot;: &quot;Anime Nyan&quot;,
    &quot;version&quot;: (1, 0, 2),
    &quot;blender&quot;: (2, 92, 0),
    &quot;location&quot;: &quot;TO BE ADDED&quot;,
    &quot;description&quot;: &quot;&quot;,
    &quot;warning&quot;: &quot;&quot;,
    &quot;wiki_url&quot;: &quot;https://github.com/AnimNyan/UEShaderScript/wiki&quot;,
    &quot;category&quot;: &quot;Material&quot;,
    &quot;tracker_url&quot;: &quot;https://github.com/AnimNyan/UEShaderScript&quot;
}

&quot;&quot;&quot;
Version': '1.0.2' written by Anime Nyan

Adds two panels one in the Shader Editor View to save different preset shader maps and one in the 3D View to load shader maps
&quot;&quot;&quot;


def register():
    save_shader_map.register()
    load_shader_map.register()
    try:
        save_shader_map.import_default_json()
    except Exception as e:
        print(&quot;import_default_json() exception because blender is not ready yet. :&quot;, e)

def unregister():
    save_shader_map.unregister()
    load_shader_map.unregister()

print(&quot;(*) UE Shader Script add-on loaded&quot;)

I also know that my add on works with the Visual Studio code Blender Plugin when I use Ctrl + P &gt; Blender Start, but think that might start Blender differently.
As a precaution I have also added a pastebin of my whole load_shader_map.py file: https://pastebin.com/Xx18vrKz and save_shader_map.py file:https://pastebin.com/grfCCQSq however I am aware they are extremely long, only the top and perhaps the bottom of registering the classes is important.
Actually I found the solution thanks to the help of someone else:
My problem was I wasn't using relative imports, don't use sys.append
instead use relative imports like this and it worked:
#import classes
from .save_shader_map import SHADER_PRESETS_UL_items, ShowMessageOperator
#import functions
from .save_shader_map import get_preferences, get_selected_folder_presets, json_to_nodes_dict