Hi badger
I think that the fantastic suggestions of Bplus and RichardFrost are the real solution of your issue!
Nevertheless standing on your original code and on the will to use a GOSUB and a included file...
your first mistake is the line 8 of the main program
you have eaten $ at the beginning of (mistyping) $include'namefile'
after this correction now if you double click on this line of code in QB64 IDE you get a second window that show you the included file.
BUT if you compile this code you get ERROR return without GOSUB.... so you must run the RETURN instruction into the included file at line 35 of it only after a call to it... to do this you must follow my example using an IF THEN with a flag activated each time you call GOSUB to that label...
this feedback is just to show the logic that you have used behind the construction of your program with GOSUB and $include:' '.
At the place of doing all these workaround you can use a closed block of code like SUB/END SUB or FUNCTION / END FUNCTION, more flexible and powered by local variables.
Good Coding