I am taking a stab at python development in blender, but the execution of a simple concept is defeating me. I want to simply use composition and packages in my .py development. So instead of a single py file with a bunch of classes within it (messy) I want to place my classes in a separate py file (module) within a sub package; However I can’t seem to get this simple concept to work.
my package structure I have my Initial file init.py I also have a directory named menu, and two files within that: my_menu.py and init.py
In my top level init.py I have the following code:
inside the menu subfolder your init.py will have to have a import __my_menu
files are not automagically imported
thus why you get that error.
please bare in mind that using double underscore in front of any name is used by python to note “privacy” that the user should not access that feature, but other than that double score is both ugly and meaningless and not recommended as general python practice. As matter of fact that “privacy” is really fake.
Thank you kilon, I am quite new to python and assumed double underscore was a naming convention for python modules, glad to hear it is not, and you are right, it is quite ugly I will fix directly. I will give placing an import my_menu_ within my init.py a try.
Also I figured out I have to place a a import from add_on_directory_name import fileName for blender to to see my addon. Is this correct?