at the moment, if an expanded class start after line 20, we round that back to line 1 to take imports and constants. But when the class to expand is not the 1st class of the file, then it would probably be better to read the file from line 1 until the 1st class so it would also inject imports and constants into the context.
May be it's debatable for the imports, may be we might skip odoo* and other common imports but missing the constants is certainly an issue.