Python Forum
Error when refering to class defined in 'main' in an imported module
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error when refering to class defined in 'main' in an imported module
#3
(Apr-13-2021, 07:00 PM)Yoriz Wrote: Yes create it in one module and import it from that module into anywhere you want to use it.

Thank you for your reply! But it turns out that this is not really necessary...
The problem I was trying to solve can be solved in another way.

I am using the Kivy framework, so my 'main.py' file "imports" a file written in the Kivy language:

Builder.load_file('MyTabbedPanel.kv')
The real problem was that this was placed AFTER:

from sharebox_ios_etc import ShareBox
So I just had to put them in this order:

Builder.load_file('MyTabbedPanel.kv')

from sharebox_ios_etc import ShareBox
Reply


Messages In This Thread
RE: Error when refering to class defined in 'main' in an imported module - by HeRo - Apr-13-2021, 07:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Variable is not defined error when trying to use my custom function code fnafgamer239 4 647 Nov-23-2023, 02:53 PM
Last Post: rob101
  How to read module/class from list of strings? popular_dog 1 519 Oct-04-2023, 03:08 PM
Last Post: deanhystad
  can not import anaconda pandas module. PySpark pandas module is imported!! aupres 0 753 Aug-06-2023, 01:09 AM
Last Post: aupres
  "Name is not defined" when running a class lil_e 6 4,225 Jan-12-2023, 11:57 PM
Last Post: lil_e
  My code displays too much output when importing class from a module lil_e 4 1,222 Oct-22-2022, 12:56 AM
Last Post: Larz60+
  Python-for-Android:p4a: syntax error in main.py while compiling apk jttolleson 2 1,954 Sep-17-2022, 04:09 AM
Last Post: jttolleson
  No module found when I run a main.py tomtom 2 1,530 Jul-20-2022, 09:24 AM
Last Post: tomtom
  Can a module tell where it is being imported from? stevendaprano 3 1,226 Apr-12-2022, 12:46 AM
Last Post: stevendaprano
  [variable] is not defined error arises despite variable being defined TheTypicalDoge 4 2,221 Apr-05-2022, 04:55 AM
Last Post: deanhystad
  Error 'Contour' not Defined DaveG 3 2,425 Mar-13-2022, 03:29 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020