T
T
TriKrista2018-01-24 23:04:07
Erlang
TriKrista, 2018-01-24 23:04:07

How to import modules from different directories?

There is a module located in the /foo/faa directory. How can I import a module located in the /foo/fii directory into it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2018-01-25
@TriKrista

When starting erl, write the path to .beam files.
Example: erl -pa some/path.
You don't need to do anything in the source code. Just use the module name as it is.

D
Dmitry Tyuterev, 2018-01-25
@dmitryttt

It is not clear what is meant by module import. If these modules are within the same assembly, then they will end up in / ebin (after compilation) in the same structure.
Those. if there are src/a/a.erl and src/b/b.erl , then you don't need to import anything to use b.erl module functions in a.erl, just use b:func(...
after the project is built (for example rebar) both files will end up in /ebin/{a,b}.beam

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question