Colab

import myfirstmodule

this is a module
myfirstmodule.important_function()

'really'
important_function


    ---------------------------------------------------------------------------

    NameError                                 Traceback (most recent call last)

    <ipython-input-3-29a2afb7c55f> in <module>
    ----> 1 important_function
    

    NameError: name 'important_function' is not defined


__name__

'__main__'
myfirstmodule.__name__

'myfirstmodule'
import copy

copy.__name__

'copy'
myfirstmodule.x

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
important_function


    ---------------------------------------------------------------------------

    NameError                                 Traceback (most recent call last)

    <ipython-input-3-29a2afb7c55f> in <module>
    ----> 1 important_function
    

    NameError: name 'important_function' is not defined


x


    ---------------------------------------------------------------------------

    NameError                                 Traceback (most recent call last)

    <ipython-input-4-6fcf9dfbd479> in <module>
    ----> 1 x
    

    NameError: name 'x' is not defined


import copy

myfirstmodule

<module 'myfirstmodule' from 'C:\\Users\\jbt\\myfirstmodule.py'>
blah = myfirstmodule

blah

<module 'myfirstmodule' from 'C:\\Users\\jbt\\myfirstmodule.py'>
del blah

blah


    ---------------------------------------------------------------------------

    NameError                                 Traceback (most recent call last)

    <ipython-input-10-4cbd040533a2> in <module>
    ----> 1 blah
    

    NameError: name 'blah' is not defined


del myfirstmodule

myfirstmodule


    ---------------------------------------------------------------------------

    NameError                                 Traceback (most recent call last)

    <ipython-input-12-b79c31a6e95d> in <module>
    ----> 1 myfirstmodule
    

    NameError: name 'myfirstmodule' is not defined


import json as fooledyou

json


    ---------------------------------------------------------------------------

    NameError                                 Traceback (most recent call last)

    <ipython-input-14-15e88f538b83> in <module>
    ----> 1 json
    

    NameError: name 'json' is not defined


fooledyou

<module 'json' from 'c:\\python36\\lib\\json\\__init__.py'>
import myfirstmodule as m

m

<module 'myfirstmodule' from 'C:\\Users\\jbt\\myfirstmodule.py'>
m.important_function()

'really'
import math

math.sin

<function math.sin>
from math import sin, cos, pi

math


    ---------------------------------------------------------------------------

    NameError                                 Traceback (most recent call last)

    <ipython-input-2-a984292e3e46> in <module>
    ----> 1 math
    

    NameError: name 'math' is not defined


sin

<function math.sin>
cos

<function math.cos>
pi

3.141592653589793
math.sin


    ---------------------------------------------------------------------------

    NameError                                 Traceback (most recent call last)

    <ipython-input-6-446489e8b60e> in <module>
    ----> 1 math.sin
    

    NameError: name 'math' is not defined


cos(pi)

-1.0
from copy import deepcopy

deepcopy

<function copy.deepcopy(x, memo=None, _nil=[])>
dc = deepcopy

dc

<function copy.deepcopy(x, memo=None, _nil=[])>
from json import load as jsonload

jsonload

<function json.load(fp, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)>
from math import *

acos

<function math.acos>
tan

<function math.tan>
actan


    ---------------------------------------------------------------------------

    NameError                                 Traceback (most recent call last)

    <ipython-input-18-eff514fc5599> in <module>
    ----> 1 actan
    

    NameError: name 'actan' is not defined


atan

<function math.atan>
from myfirstmodule import *

this is a module
important_function()

'really'
x

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
not_so_important()


    ---------------------------------------------------------------------------

    NameError                                 Traceback (most recent call last)

    <ipython-input-4-361ab7325792> in <module>
    ----> 1 not_so_important()
    

    NameError: name 'not_so_important' is not defined


import blah.blah

blah
import os

os.path.realpath('.')

'C:\\Users\\jbt'
import blah.meow

blah
import myfirstmodule

this is a module
import myfirstmodule

this is a module
ive been imported as myfirstmodule
help(myfirstmodule.not_so_important)

Help on function not_so_important in module myfirstmodule:

not_so_important()
    meh
    no really
    not so important