calling a function from main loop using push button code

Robin2:
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

you are right but i used to ask experienced people before doing any thing to avoid making mistakes that's all specially for beginners like me

regards...