It’s called a module in BAS. In your project check the ui tools on top. Select the functions you want to export and that’s it. Later you can enable or disable for any other scripts
Hope that really answered your problem. Can also use the "Select Records" command, change the Table to the second one and add any filters you need. This will return all records in a list and using the Foreach will get the job done.