I realize that not everyone attempting to use Python and the RL API is a programmer so here are some thoughts for you:
When creating your folder names under "Bin64\OpenPlugin\[yourapiname]" keep in mind that this is probably where everybody's project folders will be placed when you download/purchase them in the future so be sure to create a unique name for your folder so that it hopefully will not conflict with other dev's folder names. You should also put all your files/modules in the same folder for that project.
You should always put in your main.py file a comment line that indicates the version of your code. When you have many users of your code, knowing what version they are using helps in tracking down issues.
I also put on each versions comment line the date of that version and what the changes were. Typically you will change a version number after each release.
#V1.0.0 12/23/18 Created
#V1.0.1 12/27/18 Fixed .....
The version number could also be displayed in an "About" menu selection, if using menus, or just displayed in one of your panels somewhere.
You could also create a text file in your folder with the version info.
Keep in mind that not everyone using your project will be savy about how to find the version info so try to make it easy for them.
Since each folder has only one (1) main.py file, you will need multiple folders for multiple projects or you can provide a menu of your multiple projects/functions and contain all the files for those functions in one folder.
Yes, you must "import" into a file any external files that contain items that are referenced from that file.
The "import" makes visible the items in the external file to the file importing it. This is a standard practice.
Other programming standards for Python are as follows:
- Variables, functions, methods, packages, modules
- Classes and Exceptions
- Protected methods and internal functions
- Private methods
General Naming Guidelines
Avoid one-letter variables (esp.
Exception: In very short blocks, when the meaning is clearly visible from the immediate context
Use 4 spaces--never tabs. Enough said.
Import entire modules instead of individual symbols within a module. For example, for a top-level module
canteen that has a file
import canteenimport canteen.sessionsfrom canteen import sessions
from canteen import get_user # Symbol from canteen/__init__.pyfrom canteen.sessions import get_session # Symbol from canteen/sessions.py
Exception: For third-party code where documentation explicitly says to import individual symbols.
Put all imports at the top of the page with three sections, each separated by a blank line, in this order:
- System imports
- Third-party imports
- Local source tree imports
Rationale: Makes it clear where each module is coming from.
Use them sparingly. Prefer code readability to writing a lot of comments. Often, small methods are more effective than comments.
For more info on Python Style see HERE
See my CTA Tutorials on the YouTube channel CTAStepByStep
Check out EZColors for CTA. The easy way to change Render Styled (RS) colors.