Use a twig variable inside a twig render I am rendering a node field (which is an url to an image) in the node template file like bellow

&lt;section class="bg" style="background-image: url({{ file_url(node.field_picture_bg.entity.fileuri) }});"&gt;


Works as its supposed to, but i have some logic which tests which exact image field to render and i would like to render the field name from a variable, like so bellow (WHICH DOESNT WORK obviously :) ).

&lt;section class="bg" style="background-image: url({{ file_url(node.MYVARIBLE.entity.fileuri) }});"&gt;


Where MYVARIBLE is the name of the field. Is this even possible in twig?
I know i can archive this with an conditional clause since there are only 2 possibilities for the field name, but this way is more
You can use the variable inside of the method get():

{{ node.get(MYVARIBLE).entity.fileuri }}