Python only ever has a local and global namespace. In your example B was never defined in the namespace of A. Here’s your code using local namespaces.
You’re likely using this in a component action script. I’m not sure that you can easily reference that namespace, even from what would seem to be a “sibling” namespace (remember only 2, not a hierarchy).
Use Script Modules (Project->Script Modules or cntl+M) to make functions globally accessible. For example, create a module called test under the app package with the following code:
On the component action, use either:
Keep in mind that the app and fpmi packages have been pre-imported for you on component Actions. You need to import packages in order to call their functions within the Script Modules section.