Relative Content

Tag Archive for pythonfunctionimport

What is the best practice on importing packages for functions in a multi-file project

I have a multi-file project, where I have one main file and import almost all necessary functions from other files. Some of these functions require certain packages.
I would import all packages at the beginning of the main file, but then the functions I am importing do not work without being imported in the main file. Is this considered bad practice? If so, what would be the best way to implement this?

How to import libraries

I’ve been using python as a trig calculator and I need to regularly access functions like sin, cos, tan, arcsin, pi, etc. It isn’t that troublesome to type from math import sin,cos,tan,pi, but it is a minor hassle entering all the needed information every time I open up a new terminal.