How to load external F# script file and use it in F# interactive?

ぐ巨炮叔叔 提交于 2019-11-29 03:07:02

I suspect that the script you are loading is not in a module which may be causing your problem. Just add

module Script1

in the first script and then you can do

#load "Script1.fsx"
open Script1

and your functions will be accessible

If you don't declare a module in fsx file, it implicitly creates a module the same name as file name.

Therefore, you can always refer to another fsx file using fully qualified names or opening respective modules before use. For example, in Script2.fsx you can do:

#load "Script1.fsx"

open Script1

// Use functions in Script1.fsx
// ...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!