Understanding how editor only code works compared to gameplay code

Hi, just trying to make sure I understand how editor only code works. I believe that things like Blutility, creating materials, and such are all available through UE4 python libraries, but I believe adding commandlet to it will allow the script to be executed before the game. Is that correct?

Therefore, suppose if I want to create a material at runtime, I can access editor only modules such as the material factory and asset packages, write code to create a new material, but run this editor only module in a packaged game through python scripts, prior to actually launching the game. Once the python script detects that the script has executed successfully, then the packaged game can be launched.

Am I understanding this correctly?

Just for Reference, here are some of the links to the documentation I found on this:
Python API
Create a material in editor
Scripting the editor in python
How to create commandlets