How to get pipeline script def variable in step

I want to access def variable that define in pipeline script by code in step.
for example,pipeline script below:

node() {
 def ss = "hello world"
 stage('test') {

how can I access ‘ss’ variable in ‘MyCustomStep’,I don’t want access by “$ss” in script,I want access by code