如何在 Julia 中撤消 "using module"?

how to undo "using module" in Julia?

我运行

using myModule

但是,因为 myModule 有运行时错误,我想撤消那个 using 语句。 有没有办法在 Julia 命令行中做到这一点?

我知道我可以简单地关闭并重新启动 Julia REPL,但我想避免这种情况,因为它启动相对较慢(至少在 Windows 上)。

如前一回答中所述question, 并参考 Julia documentation

workspace()

Replace the top-level module (Main) with a new one, providing a clean workspace. The previous Main module is made available as LastMain. A previously-loaded package can be accessed using a statement such as using LastMain.Package.

This function should only be used interactively.

正确答案是使用 workspace() 函数。