Reputation: 711
In Mathematica 14.0.0 (MacOS Sonoma 14.4.1) I made a simple package consisting of two "sub packages". One of them is loaded as "private" from with the main package:
The package structure is in the subdirectory LP
in my user directory (MacOS /Users/twan
:
LP/
Kernel/
init.wl
Main.wl
Sub.wl
The contents of the files is as follows:
For init.wl
:
(* ::Package:: *)
Get["LP`Main`"]
For Main.wl
:
(* ::Package:: *)
BeginPackage["LP`Main`"]
dummy::usage = "dummy[s] with s a string to be formatted by the format function in LP`Sub"
Begin["`Private`"]
Needs["LP`Sub`"]
dummy[s_] := subformat[s]
End[]
EndPackage[]
For Sub.wl
:
(* ::Package:: *)
BeginPackage["LP`Sub`"]
subformat::usage = "subformat[s] format string s, say, to uppercase"
Begin["`Private`"]
subformat[s_]:= ToUpperCase[s]
End[]
EndPackage[]
When I do: FindFile["LP
"]` the function returns with "/Users/twan/LP/Kernel/init.wl" as expected.
However, when I do: Needs["LP
"]` it complains:
I've no clue what has gone wrong, because everything seems to work. Checking the $ContextPath
gives: "LPMain
, ..." as desired, moreover, dummy
works as expected.
dummy["test"]
TEST
My questions are:
Off[Needs::nocont]
, what do I do to prevent this?This is a very simplified version of my big project and it behaves a bit different but with a similar annoyance: the same message occurs when Main.wl
loads Sub.wl
.
Thanks for reading this far anyway.
Upvotes: 0
Views: 54