I'm new to python and attempting to split off my executes for my panels buttons into a new .py file. However, when I try to run the script I receive the following error :
init.py line 27 in "ImportError: attempted relative import with no known parent package"
the related init.py lines are :
if "bpy" in locals():
import importlib
importlib.reload(xmlhandler)
importlib.reload(zokfunctions)
else:
from bl_wep_export import xmlhandler
from bl_wep_export import zokfunctions
if "bpy" in locals():
import importlib
importlib.reload(xmlhandler)
importlib.reload(zokfunctions)
else:
from bl_wep_export import xmlhandler
from bl_wep_export import zokfunctions
import bpy
from math import radians
from .zokfunctions import execute
The zokfunctions.py file has a simple
def execute(self, context):
print("TEST")
return {'FINISHED'}
I've tried several solutions, like removing the period before zokfunctions or using a class in zokfunctions called Hello and registering it, which throws an attribute error if I remember correctly..
I do my editing in VScode and the files itself are in my blender addons folder installed as an addon, so it is addons/myaddon/the init file and zokfunctions file.