I believe that the answer choosen as answer is not fully correct.
It seems that File1.py
is your main script which is executed,
and File2.py
is a module which contains a class
you wish to use in File1.py
Also based on a previous question of the OP I would like to suggest the following structure:
File1.py and File2.py are located in the same direcory
File1.py
import MongoEngine
from File2 import Book
me = MongoEngine(app)
# according to the documentation
# you do need to pass args/values in the following line
my_book = Book(me.Document(*args, **values))
# then do something with my_book
# which is now an instance of the File2.py class Book
File2.py
import MongoEngine
class Book(MongoEngine.Document):
def __init__(self, *args, **kwargs):
super(Book, self).__init__(*args, **kwargs)
# you can add additional code here if needed
def my_additional_function(self):
#do something
return True