calling a function from main loop using push button code

Alaxwora:
in case of changing push button state from low to high state during the working of project it will automatically move fromfunction ( loop1 ()) to function ( loop2() ) ? or it will keep executing first function ( loop1() )

Why don't you try it and see what happens.

I believe my suggestion will work differently from @UKHeliBob's

You should get into the habit of writing really short programs to try out new concepts before applying them into a serious program.

...R