It’s impossible. If you want to access the global object from the UI, then you need to send a message from the UI to the plugin code, and then in the plugin code access the figma
global object.
Please see the developer documentation for an example: Creating a User Interface | Plugin API