Skip to main content
Question

importVariableByKeyAsync returning local variable

  • December 12, 2024
  • 4 replies
  • 24 views

Sergey_Dubina

I’m trying to use importVariableByKeyAsync method: importVariableByKeyAsync | Plugin API.

It’s described as method for getting variable from published library. But I’m getting only local variable

4 replies

tank666
  • 4873 replies
  • December 12, 2024

Could you please add a detailed description? This method imports a remote variable from a library.


Sergey_Dubina
  • Author
  • New Member
  • 2 replies
  • December 13, 2024

My goal is to compare local and published variables. Is there any other way to do this if method importVariableByKeyAsync doesn’t match my needs?


Sergey_Dubina
  • Author
  • New Member
  • 2 replies
  • December 13, 2024

I published my variable to library. Then I changed the same variable locally. When I’m calling importVariableByKeyAsync, I expect to get variable stored in published library, but I get local variable


tank666
  • 4873 replies
  • December 16, 2024

It looks like you are running the plugin and using this method in the same file where this variable is published. Instead, you should have run the plugin in a different file (not the library file where this variable is published). That is, get a local variable in a library file, then open another file and import that variable.

Also consider using REST API if your plan allows it:
https://www.figma.com/developers/api#variables


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings