Wrap 3rdparty-post script body to function and declare variable as local.