Approaches may differ depending on where BSF Sampler and Beanshell PreProcessor live.
If Beanshell PreProcessor is a child of BSF Sampler - it won't play as PreProcessors are executed before samplers.
For other cases:
If you look at the top of "Script" input you'll see some pre-defined variables names like `ctx`, `vars`, `props`, etc.
For instance, "vars" stands for JMeterVariables class instance, so you can set variable in BSF Sampler and access it in Beanshell PreProcessor as:
If above approach won't help update the question with screenshot of your test plan.
- Pre-defined variables like ctx, vars, props, etc. are described in detail in the How to use BeanShell: JMeter's favorite built-in component guide.