There are various different ways how to do this.
You could get the anim instance of your skeletal mesh in your characters blueprint and from there you could cast to your anim blueprint and set a variable. For example in your Character BP:
MyMesh->GetAnimInstance->CastToMyAnimBP_Number1->Set_useFlashLight_variable …and then just do something with it in the AnimBP… either in the animgraph or the statemachine.
However … if you would use your (base) character blueprint for different characters with different anim blueprints then it’s not that cool if you have to add various casts for various different anim BPs at that place. Example:
You could even get the character blueprint in the anim blueprint. For example in your AnimBP:
However …if you would just get a bool that only changes if some input was done from time to time it would be a waste of performance to check and check and check again each tick.
You could even create a blueprint interface. Add a function like Set_useFlashlight with some bool input in the Blueprintinterface. Add the Blueprint interface to the “Class settings” (Details tab, Interfaces) of all your different anim blueprints and to your character blueprint (and any other blueprint you like) and do something like this afterwards: