Originally posted by **BECATRUE** March 23, 2023
I have a question about `_add_to_path()` function in `swift.swift` module.
The function is as below:
```python
@contextmanager
def _add_to_path(path: str):
"""Adds a path temporarily.
Using a 'with' statement, you can import a module without changing sys.path.
Args:
path: A desired path to be added.
"""
old_modules = sys.modules
sys.modules = old_modules.copy()
old_path = sys.path
sys.path = old_path.copy()
sys.path.insert(0, path)
try:
yield
finally:
sys.path = old_path
sys.modules = old_modules
```
In the function, we change only `sys.path`, but why do we even care about `sys.modules`?
I think it is not neccessary to consider `sys.modules`.
Discussed in https://github.com/snu-quiqcl/swift/discussions/111
Feature you want to implement
I just want to remove the part about
sys.modules
.