This is the 669th most frequent Persian word.
مدتی
A period of time.
In this sentence, 'مدتی' (a while) refers to an unspecified duration of time spent in Tehran.
من مدتی در تهران زندگی کردم.
I lived in Tehran for a while.
Here, 'مدتی' (some time) indicates an indefinite period of time that passed before deciding to learn painting.
بعد از مدتی، تصمیم گرفتم نقاشی یاد بگیرم.
After some time, I decided to learn painting.
'مدتی' (a while) in this context is used to denote a period of time that has elapsed since the last meeting with the person.