Either use object-oriented programming(declare classes) and make but_01 a static variable. Or pass this but_01 as an argument to the function get_display_ent_01() when you call it.