title: Type variable ... is unbound
body: <p>I have a base class <code>BaseTemplateData</code> which inherits from <code>pydantic.BaseModel</code>. Then, I want to have a property of the <code>BaseTemplate</code> class which stores a type of a child class of <code>BaseTemplateData</code>.
  I'm doing the following, but I'm getting a mypy error saying <code>Type variable &quot;file.path.TemplateDataType&quot; is unbound</code>, when I'm explicitly passing a <code>bound</code> parameter to the <code>TypeVar</code> call.</p>
  <p>I also would like to have another class <code>BaseTemplate2</code> which property doesn't store the type itself, but an instance of a child class of <code>BaseTemplateData</code>. Would the approach be correct?</p>
  <p>Any help would be much appreciated. Thanks!</p>
  <pre class="lang-py prettyprint-override"><code>from typing import Type, TypeVar
  
  from pydantic import BaseModel
  
  
  class BaseTemplateData(BaseModel):
      &quot;&quot;&quot;
      Base class for all templates.
      &quot;&quot;&quot;
  
  
  TemplateDataType = TypeVar(&quot;TemplateDataType&quot;, bound=BaseTemplateData)
  
  
  class BaseTemplate(BaseModel):
      &quot;&quot;&quot;
      Template class for email templates
      &quot;&quot;&quot;
  
      data_model: Type[TemplateDataType]
  
  
  class BaseTemplate2(BaseModel):
      &quot;&quot;&quot;
      Template class for email templates 2
      &quot;&quot;&quot;
  
      data_model: TemplateDataType
  </code></pre>