# Plotting priors using the 'TransformedRV' functionality throws no attribute error

Hello,

I am trying to plot the priors , something as below:

By using the below function (not written by me, but is an older version of pymc3)

``````#plots priors using the random variables
def plot_priors(variables, prior_dictionary = None):
if isinstance(variables[0], pm.model.TransformedRV) == False and prior_dictionary is None:
raise Exception("prior dictionary should be provided. It can be generated by sample_prior_predictive")
cols = 2
rows = int(math.ceil(len(variables)/cols))
fig, ax = plt.subplots(rows, cols, figsize=(15, 3*rows))
ax = np.reshape(ax, (-1, cols))
for i in range(rows):
for j in range(cols):
vi = i*cols + j
if vi < len(variables):
var = variables[vi]
if isinstance(var, pm.model.TransformedRV):
sns.histplot(var.random(size=10000).flatten(), kde=True, ax=ax[i, j])
#p.set_axis_labels(var.name)
ax[i, j].set_title(var.name)
else:
prior = prior_dictionary[var]
sns.histplot(prior, kde=True, ax = ax[i, j])
ax[i, j].set_title(var)
plt.tight_layout()
``````

However this gives the error :

``````AttributeError                            Traceback (most recent call last)
Cell In[108], line 2
1 adstock_priors = [p for p in prior_names if p.endswith("adstock")]
----> 2 plot_priors(adstock_priors, prior_pred)
5 alpha_priors = [p for p in prior_names if p.endswith("alpha")]

Cell In[20], line 128, in plot_priors(variables, prior_dictionary)
127 def plot_priors(variables, prior_dictionary = None):
--> 128     if isinstance(variables[0], pm.model.TransformedRV) == False and prior_dictionary is None:
129         raise Exception("prior dictionary should be provided. It can be generated by sample_prior_predictive")
130     cols = 2

AttributeError: module 'pymc.model' has no attribute 'TransformedRV'
``````

I am assuming that the latest pymc version model doesn’t have this attribute anymore or I am not using it currently.
Since I am new to pymc (4 weeks) I would really appreciate if someone can guide me on this?
Cheers!!

Just call pm.draw for each variable or pm.sample_prior_predictive to get all variables . There is no such thing as a TransformedRV like that