Is it possible to import a module with some parameter in python ?
All I mean by parameter is that there exists a variable in the module which is not initialized in that module, still I am using that variable in that module. In short, I want behavior similar to a function but unlike function, I want the variables of module to be exposed in the calling code.
eg a.py
:
#lists like data, count, prob_distribution are constructed from training_pool (not initialized in this file)
x = pymc.Uniform('x', lower = 0, upper = 1)
rv = [ Multinomial("rv"+str(i), count[i], prob_distribution[i], value = data[i], observed=True) for i in xrange(0, len(count)) ]
b.py
:
import a #I want some way tr pass value of training_pool
m = pymc.MCMC(a)
I want all random variables in a.py
to be exposed to MCMC
. I am open to a better approach for my problem at hand, but I would also like to know whether passing arguments to modules is possible in python or not.
from a import *
? – Borlase