I want to use an object that was created inside a class from a standalone module. I am trying to do this by making the object reference global. I think I want to use the current object, and not create a new one.
Suppose I have this code in a module file
import moduleFile class A(): def checkAdmin(self): global adminMenu adminMenu = SRMadminMenu() class SRMadminMenu() def createAdminMenu(self): pass
In moduleFile.py I have this code
def moduleFile_Admin_Menu(): global adminMenu adminMenu.createSubMenu("Module Administration")
the code in the file.py module gives me the following error.
NameError: global name 'adminMenu' is not defined
source share