When you install a new addon its added to the blender scripts/addons folder, so you can also just create a new folder directly in that folder and it will be detected by blender immediately if it has the necessary files.
the line above is the default path in windows, where blender installs your addons.
the 3.1 is the version of blender installed so you may want to change that to the version you have and the last piece of text “Addons” is the folder where you will add your addons
Blender addon Required files
A blender addon only requires one file the __init__.py file, you can have everything in that single file and your addon will work, but that would be headache to work on as addons can be hundreds of lines of code.
Blender addons are created in python so most of your files that run code are going to end with the .py extension
The __pycache__ is not a folder to worry about this is handled by python its self, only thing you need is the __init.__.py, you can use any code editor like sublime text or nodepad++ but i prefer using visual studio code
The __init__.py file
when blender first loads it goes through the addons folder looking for any folder with the __init__.py file, any folder containing this file will be considered an addon, then blender goes on to run this file as a python file if it gets errors the addon will not be registered if there no errors you will see the addon in the addons list.
__init__.py file contents
"name" : "Addon Template",
"author" : "Your Name",
"description":"Making blender faster to use",
"version" : (2,1,0),
"blender" : (2,91,0),
"location" : "Right 3d View Panel -> Addon Template",
"category" : "Object"
modules = 
for mod in modules:
if __name__ == "__main__":
bl_info is a python dictionary that contains all the information about the addon, from name of the addon, author and version
the import bpy is a blender python module that has all the functions/methods that help your addon interface with blender core functions.
the register method is necessary to register any classes for your addon these include your buttons/operators, UI panels and addon data that would be stored for later use.
the register method is run immediately on addon activation
the unregister function does the opposite and runs on addon deactivation.
every programmer handles there project differently but this is the most common way of making addons in blender.
the if statement at the bottom calls the register function when the addon is activated
the import importlib and code after it in the register method is not necessary but i add it so that blender reloads the modules i create my self, these would be other python files like a functions.py, buttons.py modules i keep my code organise, you can usually get away with just the import statement but i have found it to not work as expected sometimes blender fails to see the updated code.
when you activate the addon run it does nothing in the viewport and wont show up because we have not really given it any functionality yet,
if you go to the blender window menu and then windows console you will see the addon printing something along the lines ‘//////////addon registered//////////’ i added this line to show me when the addon has successfully registered or not, though if it fails you will get a prompt from blender depending on the type of failure
its going to be necessary to have the blender console open all the time while coding your addon as this is where you are going to see any errors show up or tests you make.
if you want to see the addon template as it is now: