Is it possible to import a nested package to a matlab function

import, matlab, package

Solution

import primary_package.secondary_package.*;
goo();

should work just fine. At least it works for me.

EDIT: make sure that `base_folder` is in your `path`.

Problem

I have the following directories tree on my hard-drive: base_folder base_folder\+primary_package base_folder\+primary_package\+secondary_package Assume under `primary_package` I have a function `foo` which calls a function `goo` that is stored in `secondary_package`. Meaning I have the following files: base_folder\+primary_package\foo.m base_folder\+primary_package\+secondary_package\goo.m foo's implementation is: ``` function [] = foo() primary_package.secondary_package.goo(); end ``` It works, but in practice I have many calls to many functions in `secondary_package` and it makes my code unreadable. I tried the following which didn't work: ``` function [] = foo() import primary_package.secondary_package.*; goo(); end ``` Is there a way of importing the nested package to avoid many very long lines in the code?

Original source