title: Refactor with pyCharm from "user" to "self.user"
body: <p>I want to move a variable from local scope to object level. The new code should use <code>self.user</code> and not <code>user</code> like before:</p>
  
  <pre><code>class Foo(object):
      def test_foo(self):
          user=User()
          ...
          user.do()
  </code></pre>
  
  <p>New code should look like:</p>
  
  <pre><code>class Foo(object):
      def test_foo(self):
          self.user=User() # I can remove this line by hand
          ...
          self.user.do()
  </code></pre>
  
  <p>I tried to refactor>>rename from <code>user</code> to <code>self.user</code> but pyCharm says: "Inserted identifier is not valid"</p>
  
  <p>How can I refactor this with pyCharm?</p>