call the method executor.migration_plan wiht return value of te method executor.loader.graph.leaf_nodes as argument, substitute it for plan.
plan = executor . migration_plan ( executor . loader . graph . leaf_nodes ( ) )