The best thing to do woul.d be to split your include file into functions (modules). When you use include / require nothing will happen unless you call a spcific function from within the main script.
To extract only parts of a file you'd need to use regular expressions, which gets a bit complicated.