0👍
This issue almost always occurs because you are using a flat file structure for your project, and you try to split the functionality into two files.
1. First method
The easiest way to solve that is to import the file before calling his elements.
First, do this:
import tools
And then if you have for instance a function called "myfunction()" in your tools.py file, then you can use this function as following:
var = tools.myfunction()
2. Second method
If you are making a separate file to do helpful things, why not make it an actual package? It is actually much easier than you would think.
Change up your file structure so that the functionality you want to split out is in a separate folder and includes an empty init.py file. Something like this:
check_project
--- check_app
--- check_project
--- modules
--- __init__.py
--- robots.py
--- tools
--- __init__.py
--- tools.py
And then, you can use your previous syntax:
from tools import *
Hope this help.
- [Answered ]-Order strings fields in django QuerySet by specific order
- [Answered ]-What is the recommended way to create a blank row in the DB for a django Model?
- [Answered ]-Django import / export: ForeignKey fields return None
- [Answered ]-Using an abc.ABC class object in a Django template: why Django tries to instantiate it?
- [Answered ]-Google app engine and django templates: passing entity ids to the template engine