Programmatically creating parameters in ModelingToolkit.jl leads to unexpected outcome

I am trying to create programmatically a parameter (with @parameter) with ModelingToolkit.jl. While I am succeeding, the outcome is not exactly what I wish for. Here are the two examples:

@variables t            # independent variable (time)
dDt = Differential(t)   # define an operator for the differentiation w.r.t. time
@variables T(t) = 300.0 # dependent

function lhs1(timescale)
    pars = @parameters τ_T = timescale
    τvar = first(pars)
    return τvar*dDt(T)
end

function lhs2(variable, timescale)
    varsymbol = Symbol(:τ_, Symbol(variable))
    pars = (@parameters $(varsymbol) = timescale)
    τvar = first(pars)
    return τvar*dDt(variable)
end

lhs1(5.0)
lhs2(T, 5.0)

which give:

        
julia> lhs1(5.0)
τ_T*Differential(t)(T(t))

julia> lhs2(T, 5.0)
var"τ_T(t)"*Differential(t)(T(t))

as you can see, in the second case the created parameter is first not displayed correctly, and second, it is not a parameter at all, it is presented as a function of time. What do I have to do to make lhs2 give exactly the same expression as lhs1?

EDIT: The second problem, that T(t) is displayed, happens because of casting the variable T into a symbol, which includes the (t). So I know how to fix that. The first problem of being displayed as var"..." I don’t know how to fix.

Symbol(:τ_, ModelingToolkit.name(variable))

Interestingly, solving the second issue also solved the first. Simply doing

    varsymbol = Symbol(:τ_, Symbol(string(variable)[1:end-3]))

solves the problem!

Thanks @ChrisRackauckas but this function doesn’t seem to exist, and I just updated:

  [961ee093] ModelingToolkit v8.69.1

julia> ModelingToolkit.name
ERROR: UndefVarError: `name` not defined
Stacktrace:
 [1] getproperty(x::Module, f::Symbol)
   @ Base .\Base.jl:31
 [2] top-level scope
   @ REPL[2]:1

oh sorry, ModelingToolkit.getname