No module named "my_globals"

What I’m trying to do:
Import the “my_globals” module.

What I’ve tried and what’s not working:

Code Sample:
I’ve tried all 3 of the lines below:


import my_globals
from .. import my_globals
from . import my_globals

All of them cause an error. Can I not import a module into a Client Form?

Clone link:
share a copy of your app

You just have to get the import right. The easiest way is to start typing from my_globals and pick from the list the autocompleter gives you. It isn’t always easy to guess how many dots you need; sometimes it isn’t the number the package layout would imply.

Edit…that error message makes it look like it might be a circular import, which also gives the same error message. Can you confirm if you have a circular sequence of imports? e.g. User_form imports my globals which imports Admin_page which imports my_globals

3 Likes

It sometimes can be three dots as well. And since you have tried everything else, it will most probably be 3 dots.

Basically, it depends on the number of sub-packages you have. Like the more forms you nest inside a form or module, the more dots it requires.

A standard form will require one dot. A form nested inside the standard form will require 2 dots. And another form nested inside our already nested form will require 3 dots and so on

1 Like

It looks like I had a circular import. I was thinking it was the number of dots.

my_globals <–import–> Admin_Page

Thanks @jshaffstall!

3 Likes