How to substitute variable in expression contains its derivative also

 using SymPy
using PyCall
sp  = pyimport("sympy")
t1 = sp.Function("theta_1")(t)
f = t1^2 +t1
df = sp.diff(f,t)
# so df = 2*t1*(d(t1)/d(t))+ (d(t1)/d(t))
# if substitution done of t1 value that is t1 = 2 
s =  df.subs([(t1,2)])
# the s is  s = 2*2*(d(2)/d(t))+ (d(2)/d(t))
#  but i need s =2*2*(d(t1)/d(t))+ (d(t1)/d(t))

so i need that sympy will treat two different things t1 and d(t1)/dt
thanks…

using SymPy

@syms t t1()

f = t1(t)^2 +t1(t)
df = diff(f, t)

@syms dt1
s = subs(df, (diff(t1(t), t), dt1))
s = subs(s, (t1(t), 2))
s = subs(s, (dt1, diff(t1(t), t)))

Thanks, but this not a stable method, I also deal this problem like that. but if i have 10 variable with second order differential equation. i have to write substitute things every time. is there any method or library or python sympy method for that?
thanks…