Is it possible to access enclosing context manager?
Is it possible to access the context object (code block) inside the __exit__() method of a context manager?
Scope of Python variables in this case - Difference between Enclosing and Local Variable Python with...as for custom context manager How to use a context manager in python Why can't a module be a context manager (to a 'with' statement)? Python get list of all enclosing files How to make inner functions see variables of enclosing function? Writing a Python class that can only be used as a context manager Use a context manager for python script output to a file? Python Enclosing Words With Quotes In A String Why can you use open() as context manager? Python: standard function and context manager? Why can't my function access a variable in an enclosing function? Context manager inside a class instance How can a Python context manager try to execute code? Use context manager as a function Nested Python class needs to access variable in enclosing class Why I can't get enclosing variable at the recursion function in Python Python access attributes of an enclosing class (not parent) Use context manager in lambda, how? Is there any way to get source code inside context manager as string? How to find the enclosing class of a Python method in Emacs Python enclosing scope variables with lambda function context manager I/O operation in file How can I access attributes of a context manager? class getting kwargs from enclosing scope Open a list of files using with/as context manager What are enclosing functions? How do I write this as a context manager? Enclosing functions scope search?