Is there a way I can store my import packages inside a module and then run said module to load the packages? Something like below:
# Store imports in a module
def LoadPackages():
import pandas as pd
import numpy as np
...
# Run module to load packages
LoadPackages()
I tried this and I got the below error:
d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d)
df
NameError: name 'pd' is not defined