How to avoid importing the same package name repeatedly in all functions in this package?
Show older comments
I have a package that contains n functions
+mypackwithlongname
+mypackwithlongname/f1.m
+mypackwithlongname/f2.m
...
+mypackwithlongname/fn.m
I found (with surprise) that these functions, although inside the same package, cannot call each other.
How can these functions call each other without doing "import mypackwithlongname.*" in every file? I don't want to explicitly write the package name in so many files because I will change package name in future versions. For the same reason I don't want to call functions with the package name like mypackwithlongname.f1. I'd like to make the code of f1 to fn completely independent of the package name. There's no reason they should.
Of course I can write a single function or script that returns the package's name. But I don't want to put this file anywhere outside the package because it's important in my application for the package to be self-contained instead of relying on anything external.
Why can't functions in the same package see each other without doing an import? Am I missing anything?
Related questions:
Accepted Answer
More Answers (0)
Categories
Find more on Argument Definitions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!