Have a look at Blender's add-ons folder for many examples. C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons
if you are on Windows.
Let's have a look at MeasureIt add-on for example. It has multiple files:
If you open the __init__.py
, you can see that measureit_main
is imported
and if you open it, you can see other imports:
.zip files that you use to install the add-ons are just simple zip files containing a folder named after the add-on and all the files in it.
You could also have a look at How to run a python script external to Blender to run bpy commands in Blender'spython console