(deleted)
evo85210:
Also the marlin firmware is composed of multiple sketches
Marlin is only a single sketch, which is composed of many files. You can only ever run one sketch at a time on your 3D printer.
evo85210:
I Don't really know where to add the lock function so that it's ran first before everything else.
The first part of the sketch that runs is the setup() function. This is in the file Marlin_main.cpp, line 507.But keep in mind that setup() only runs after you power on or reset the 3D printer. If you need the lock screen to activate at other times, like after a print is finished, then that won't work and you'll need to put the lock screen code elsewhere.