Declare an internal Poisson distribution inside a custom distribution failes

It’s a bit difficult to give you advice without knowing what you are trying to achieve. But at least if you are trying to make the above code running without error you can rewrite the logp as:

def logp(value):
    ipoisson = pm.Poisson.dist(mu = mu)
    return ipoisson.logp(value)