The Delphi project file (.dpr) contains the initialization logic for the program. It is partially generated by the IDE, is generally abstracted over by the .dproj file, and is underemphasized in editor tooling.
Use of the project file for complex logic bloats the application entry point, makes the project more difficult to navigate, and reduces visibility.
Move any routines out of the project file and into a separate unit, which you can then reference from the initialization section of the project file:
// MyProject.dpr // ... procedure Foo; begin // ... end; begin Foo; end.
// MyProject.dpr // ... uses MyUnit; begin Foo; end. // MyUnit.pas interface procedure Foo; implementation procedure Foo; begin // ... end;