JMeter variables have thread scope. This is deliberate, so that threads can act indepently.
However sometimes there is a need to pass variables between different threads, in the same or different Thread Groups.
One way to do this is to use a property instead.
Properties are shared between all JMeter threads, so if one thread
sets a property
another thread can
the updated value.
If there is a lot of information that needs to be passed between threads, then consider using a file.
For example you could use the
Save Responses to a file
listener or perhaps a BeanShell PostProcessor in one thread, and read the file using the HTTP Sampler "file:" protocol,
and extract the information using a PostProcessor or BeanShell element.
If you can derive the data before starting the test, then it may well be better to store it in a file,
read it using CSV Dataset.