I perform the import module operation in exec,After the foo function is executed, the pandas module memory is not released,I want to be able to clear the memory of all imported modules in the function after the function finishes,help。
Pay attention to: Module names are not fixed
from time import sleep
def foo():
code = """import pandas as pd"""
exec(code)
if __name__ == '__main__':
foo()
sleep(100)