Pass HtmlDialog to load UI.openpanel

Hello,
I am currently working on updating my extension. I am finding that many of my methods are not up to date with the new standards. I would like some advice on the best practices for this scenario.
The ruby extension script creates a tool bar that I have working. One button on the tool bar opens a HtmlDialog dialog where the user can select a texture that will be applied to a models face. Once they select the texture they can open a ruby script file that was exported separately form one of our tools. Using the load UI.openpanel. I am looking for the best method to get the selected texture to the opened ruby file so that SketchUp can create the model from the ruby file using the selected texture.
We have several tools that exports the command to create the users design in 3D using SketchUp Ruby api. This extension allow the user to select the texture (Block face and Color) to the predesign ruby script.
Previously I have been using require require Sketchup.find_support_file ‘AB_Courtyard-Pattern-Silverado.rb’, ‘Plugins/AllanBlock_RetainingWall_3DModelingTools/Textures/Courtyard’
I think I should be using @BlockFace = File.join(@Courtyard, “AB_Courtyard-Pattern-Silverado.rb”) but can’t seem to figure out how to make @BlockFace variable available from the extension ruby to the load UI.openpanel ruby script file.
Any help on this would be appreciated.

In what process would the external Ruby script file run ? And why ?

Why are you thinking separate external Ruby scripts ?
Why isn’t the functionality part of the SketchUp extension’s submodule ?

Also, selecting a texture before geometry exists is kind of like “putting the cart before the horse”.
Ie, if your extension’s material .skm files are just copied into a subfolder of the user’s %AppData% materials path, then the user can select them using the native Materials inspector panel and apply them using the Paint Bucket tool.

If you have some concrete example code it’d be easier to answer. Hard to guess that is going.

We have some basic examples of extension structures: GitHub - SketchUp/sketchup-ruby-api-tutorials: SketchUp Ruby API Tutorials and Examples

You are looking to:

  1. Have the user select a texture (bitmap file) located in the extension directory?
  2. Load that bitmap as a material in the model?
  3. Apply to some entities in the model? (to the selection or based on some other criteria?)