Apologies for more confusion. I'll try it again. I realize I have to get my point across and I appreciate your trying to help.
Yes, both (in my case) payment methods are rendered/displayed. When one is selected and the customer changes their mind and selects the other one, then the onHikashopBeforeDisplayView function is triggered multiple times, via AJAX, to refresh the various blocks (status, payment method a, payment method b, etc.). I need to only call my layout once, in this case my braintree_pay.php since it has to build a one-use, customer-specific nonce for this payment activity. Now it is being called twice, once for each displayed payment method since I can't differentiate the two triggered events.
I can avoid calling my layout when the layout is not show_block_payment. But because all the payment methods are shown in a show_block_payment layout and in the same block (3 my case) and they are in the same place in the workflow, then the two onHikashopBeforeDisplayView events appear identical and my braintree_pay.php is called twice within 1.02 seconds. This results in an error in the braintree code's generation of their hosted fields (duplicate) which results in the payment failing. Somehow I have to make sure I call my layout file only once when the user switches payment methods. I just can't find a way to differentiate the two ajax refresh events of the two payment method views. Everything is the same (view, layout, block, workflow, task, cart_payment_id, etc.) for both events. I was hoping there was some way that the $view object would tell me which payment method view was being refreshed. But there is nothing to say this onHikashopBeforeDisplayView event is for my braintree payment method and that one is for the PayPal payment method.
Maybe I'm missing something obvious. Maybe I'm using the wrong event. I want to call my payment method's layout file only once any time the page refreshes or is loaded regardless of how many payment methods are published and displayed. Is there a more appropriate event than onHikashopBeforeDisplayView?
What I was looking for, hoping for, was a variable in the $view that referred to the payment_id of the payment method for each payment method shown. It currently tells me which payment method is selected, but when my payment method is selected there are still two onHikashopBeforeDisplayView events for show_block_payment and nothing indicates that one is for the braintree payment method and the other is for the PayPal method. I want to load my layout for the braintree refresh, but I want to NOT load my layout for all the other payment methods that are displayed. I was hoping that these events would include a variable in $view that would indicate it was for payment_id = 1 or payment_id = 2. But I haven't found anything like that so far.
Thanks again. I've been working on this a long time. Your help is invaluable and I really appreciate your time.