I tried running your code, however I ran into some erros at
with open('PDE_t', 'r') as ff:
for line in ff:
secreting_list.append(line.strip())
Please provide a minimal example, that shows your problem, but also is easy to understand.
Maybe its easier to use gmsh for your geometry and mark the boundaries with tags. To my knowledge mshr is no longer maintained (Different behaviour of a mesh coming from generate_mesh() resp. UnitSquareMesh()? - #5 by dokken).
By the way: I also noticed the function solver_bcs has two indentations, thus is defined every time in the for loop, which might not be the way its inteded right?
Also I have never seen a tolerance as big as 1 for near. I generally use 1E-14